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/index.cgi?a=commitdiff_plain;h=refs%2Fheads%2F2021-07-forward-event;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, } } }