From: Matt Corallo Date: Tue, 3 Aug 2021 16:49:31 +0000 (+0000) Subject: Change return value of `claim_funds` to ignore duplicate claims X-Git-Tag: v0.0.100~10^2 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=50f47ecc05b5ade369872a8b3580301bdd977a83;p=rust-lightning 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`. --- 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, } } }