From: Matt Corallo Date: Wed, 30 Nov 2022 21:48:46 +0000 (+0000) Subject: Drop now-unused `ClaimFundsFromHop` enum and replace with an `Err` X-Git-Tag: v0.0.113~10^2~2 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=b331778e34c289cb986d2426df2e12cd2ecea568;p=rust-lightning Drop now-unused `ClaimFundsFromHop` enum and replace with an `Err` --- diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs index ecc30fd12..fa38e54ed 100644 --- a/lightning/src/ln/channelmanager.rs +++ b/lightning/src/ln/channelmanager.rs @@ -303,14 +303,6 @@ struct ReceiveError { msg: &'static str, } -/// Return value for claim_funds_from_hop -enum ClaimFundsFromHop { - PrevHopForceClosed, - MonitorUpdateFail(PublicKey, MsgHandleErrInternal, Option), - Success(u64), - DuplicateClaim, -} - type ShutdownResult = (Option<(OutPoint, ChannelMonitorUpdate)>, Vec<(HTLCSource, PaymentHash, PublicKey, [u8; 32])>); /// Error type returned across the channel_state mutex boundary. When an Err is generated for a @@ -4351,29 +4343,15 @@ impl ChannelManager { - if let msgs::ErrorAction::IgnoreError = err.err.action { - // We got a temporary failure updating monitor, but will claim the - // HTLC when the monitor updating is restored (or on chain). - log_error!(self.logger, "Temporary failure claiming HTLC, treating as success: {}", err.err.err); - } else { errs.push((pk, err)); } - }, - ClaimFundsFromHop::PrevHopForceClosed => { - // This should be incredibly rare - we checked that all the channels were - // open above, though as we release the lock at each loop iteration it's - // still possible. We should still claim the HTLC on-chain through the - // closed-channel-update generated in claim_funds_from_hop. - }, - 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(_) => {}, + if let msgs::ErrorAction::IgnoreError = err.err.action { + // We got a temporary failure updating monitor, but will claim the + // HTLC when the monitor updating is restored (or on chain). + log_error!(self.logger, "Temporary failure claiming HTLC, treating as success: {}", err.err.err); + } else { errs.push((pk, err)); } } } } @@ -4400,7 +4378,7 @@ impl ChannelManager) -> Option>(&self, mut channel_state_lock: MutexGuard::Signer>>, prev_hop: HTLCPreviousHopData, payment_preimage: PaymentPreimage, completion_action: ComplFunc) - -> ClaimFundsFromHop { + -> Result<(), (PublicKey, MsgHandleErrInternal)> { //TODO: Delay the claimed_funds relaying just like we do outbound relay! let chan_id = prev_hop.outpoint.to_channel_id(); @@ -4419,9 +4397,7 @@ impl ChannelManager ChannelManager { @@ -4461,7 +4437,7 @@ impl ChannelManager ChannelManager ChannelManager = Err(err); let _ = handle_error!(self, result, pk); }