Skip to content

Commit c140e0d

Browse files
committed
Indicate to claim_funds_internal that we're replaying on startup
While we'd previously avoided this, this is sadly now required in the next commit.
1 parent df94962 commit c140e0d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lightning/src/ln/channelmanager.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -5492,7 +5492,7 @@ where
54925492
}
54935493

54945494
fn claim_funds_internal(&self, source: HTLCSource, payment_preimage: PaymentPreimage,
5495-
forwarded_htlc_value_msat: Option<u64>, from_onchain: bool,
5495+
forwarded_htlc_value_msat: Option<u64>, from_onchain: bool, startup_replay: bool,
54965496
next_channel_counterparty_node_id: Option<PublicKey>, next_channel_outpoint: OutPoint
54975497
) {
54985498
match source {
@@ -6409,7 +6409,7 @@ where
64096409
hash_map::Entry::Vacant(_) => return Err(MsgHandleErrInternal::send_err_msg_no_close(format!("Got a message for a channel from the wrong node! No such channel for the passed counterparty_node_id {}", counterparty_node_id), msg.channel_id))
64106410
}
64116411
};
6412-
self.claim_funds_internal(htlc_source, msg.payment_preimage.clone(), Some(forwarded_htlc_value), false, Some(*counterparty_node_id), funding_txo);
6412+
self.claim_funds_internal(htlc_source, msg.payment_preimage.clone(), Some(forwarded_htlc_value), false, false, Some(*counterparty_node_id), funding_txo);
64136413
Ok(())
64146414
}
64156415

@@ -6862,7 +6862,7 @@ where
68626862
MonitorEvent::HTLCEvent(htlc_update) => {
68636863
if let Some(preimage) = htlc_update.payment_preimage {
68646864
log_trace!(self.logger, "Claiming HTLC with preimage {} from our monitor", preimage);
6865-
self.claim_funds_internal(htlc_update.source, preimage, htlc_update.htlc_value_satoshis.map(|v| v * 1000), true, counterparty_node_id, funding_outpoint);
6865+
self.claim_funds_internal(htlc_update.source, preimage, htlc_update.htlc_value_satoshis.map(|v| v * 1000), true, false, counterparty_node_id, funding_outpoint);
68666866
} else {
68676867
log_trace!(self.logger, "Failing HTLC with hash {} from our monitor", &htlc_update.payment_hash);
68686868
let receiver = HTLCDestination::NextHopChannel { node_id: counterparty_node_id, channel_id: funding_outpoint.to_channel_id() };
@@ -10057,7 +10057,7 @@ where
1005710057
// don't remember in the `ChannelMonitor` where we got a preimage from, but if the
1005810058
// channel is closed we just assume that it probably came from an on-chain claim.
1005910059
channel_manager.claim_funds_internal(source, preimage, Some(downstream_value),
10060-
downstream_closed, downstream_node_id, downstream_funding);
10060+
downstream_closed, true, downstream_node_id, downstream_funding);
1006110061
}
1006210062

1006310063
//TODO: Broadcast channel update for closed channels, but only after we've made a

0 commit comments

Comments
 (0)