From 50f47ecc05b5ade369872a8b3580301bdd977a83 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Tue, 3 Aug 2021 16:49:31 +0000 Subject: [PATCH] Change return value of `claim_funds` to ignore duplicate claims While we should never reach `ClaimFundsFromHop::DuplicateClaim` in most cases, if we do, it likely indicates the HTLC was timed out some time ago and is no longer available to be claimed. Thus, it does not make sense to imply that we `claimed_any_htlcs`. --- lightning/src/ln/channelmanager.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs index 888724c0f..ad9a7e295 100644 --- a/lightning/src/ln/channelmanager.rs +++ b/lightning/src/ln/channelmanager.rs @@ -2804,7 +2804,13 @@ impl ChannelMana } else { errs.push((pk, err)); } }, ClaimFundsFromHop::PrevHopForceClosed => unreachable!("We already checked for channel existence, we can't fail here!"), - _ => claimed_any_htlcs = true, + ClaimFundsFromHop::DuplicateClaim => { + // While we should never get here in most cases, if we do, it likely + // indicates that the HTLC was timed out some time ago and is no longer + // available to be claimed. Thus, it does not make sense to set + // `claimed_any_htlcs`. + }, + ClaimFundsFromHop::Success(_) => claimed_any_htlcs = true, } } } -- 2.39.5