Skip to content

Commit 6f1a0bf

Browse files
valentinewallaceAntoine Riard
and
Antoine Riard
committed
Claim HTLC output on-chain if preimage is recv'd after force-close
If we receive a preimage for an outgoing HTLC that solves an output on a backwards force-closed channel, we need to claim the output on-chain. Note that this commit also gets rid of the channel monitor redundantly setting `self.counterparty_payment_script` in `check_spend_counterparty_transaction`. Co-authored-by: Antoine Riard <[email protected]> Co-authored-by: Valentine Wallace <[email protected]>
1 parent e70f485 commit 6f1a0bf

File tree

3 files changed

+269
-20
lines changed

3 files changed

+269
-20
lines changed

lightning/src/chain/channelmonitor.rs

Lines changed: 67 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,6 +1165,41 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
11651165
L::Target: Logger,
11661166
{
11671167
self.payment_preimages.insert(payment_hash.clone(), payment_preimage.clone());
1168+
1169+
// If the channel is force closed, try to claim the output from this preimage.
1170+
// First check if a counterparty commitment transaction has been broadcasted:
1171+
macro_rules! claim_htlcs {
1172+
($commitment_number: expr, $txid: expr) => {
1173+
let htlc_claim_reqs = self.get_counterparty_htlc_output_claim_reqs($commitment_number, $txid, None);
1174+
self.onchain_tx_handler.update_claims_view(&Vec::new(), htlc_claim_reqs, None, broadcaster, fee_estimator, logger);
1175+
}
1176+
}
1177+
if let Some(txid) = self.current_counterparty_commitment_txid {
1178+
if let Some(commitment_number) = self.counterparty_commitment_txn_on_chain.get(&txid) {
1179+
claim_htlcs!(*commitment_number, txid);
1180+
return;
1181+
}
1182+
}
1183+
if let Some(txid) = self.prev_counterparty_commitment_txid {
1184+
if let Some(commitment_number) = self.counterparty_commitment_txn_on_chain.get(&txid) {
1185+
claim_htlcs!(*commitment_number, txid);
1186+
return;
1187+
}
1188+
}
1189+
1190+
// Then if a holder commitment transaction has been seen on-chain, broadcast transactions
1191+
// claiming the HTLC output from each of the holder commitment transactions.
1192+
// Note that we can't just use `self.holder_tx_signed`, because that only covers the case where
1193+
// *we* sign a holder commitment transaction, not when e.g. a watchtower broadcasts one of our
1194+
// holder commitment transactions.
1195+
if self.broadcasted_holder_revokable_script.is_some() {
1196+
let (claim_reqs, _) = self.get_broadcasted_holder_claims(&self.current_holder_commitment_tx);
1197+
self.onchain_tx_handler.update_claims_view(&Vec::new(), claim_reqs, None, broadcaster, fee_estimator, logger);
1198+
if let Some(ref tx) = self.prev_holder_signed_commitment_tx {
1199+
let (claim_reqs, _) = self.get_broadcasted_holder_claims(&tx);
1200+
self.onchain_tx_handler.update_claims_view(&Vec::new(), claim_reqs, None, broadcaster, fee_estimator, logger);
1201+
}
1202+
}
11681203
}
11691204

11701205
pub(crate) fn broadcast_latest_holder_commitment_txn<B: Deref, L: Deref>(&mut self, broadcaster: &B, logger: &L)
@@ -1463,39 +1498,55 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
14631498
check_htlc_fails!(txid, "previous", 'prev_loop);
14641499
}
14651500

1501+
let htlc_claim_reqs = self.get_counterparty_htlc_output_claim_reqs(commitment_number, commitment_txid, Some(tx));
1502+
for req in htlc_claim_reqs {
1503+
claimable_outpoints.push(req);
1504+
}
1505+
1506+
}
1507+
(claimable_outpoints, (commitment_txid, watch_outputs))
1508+
}
1509+
1510+
fn get_counterparty_htlc_output_claim_reqs(&self, commitment_number: u64, commitment_txid: Txid, tx: Option<&Transaction>) -> Vec<ClaimRequest> {
1511+
let mut claims = Vec::new();
1512+
if let Some(htlc_outputs) = self.counterparty_claimable_outpoints.get(&commitment_txid) {
14661513
if let Some(revocation_points) = self.their_cur_revocation_points {
14671514
let revocation_point_option =
1515+
// If the counterparty commitment tx is the latest valid state, use their latest
1516+
// per-commitment point
14681517
if revocation_points.0 == commitment_number { Some(&revocation_points.1) }
14691518
else if let Some(point) = revocation_points.2.as_ref() {
1519+
// If counterparty commitment tx is the state previous to the latest valid state, use
1520+
// their previous per-commitment point (non-atomicity of revocation means it's valid for
1521+
// them to temporarily have two valid commitment txns from our viewpoint)
14701522
if revocation_points.0 == commitment_number + 1 { Some(point) } else { None }
14711523
} else { None };
14721524
if let Some(revocation_point) = revocation_point_option {
1473-
self.counterparty_payment_script = {
1474-
// Note that the Network here is ignored as we immediately drop the address for the
1475-
// script_pubkey version
1476-
let payment_hash160 = WPubkeyHash::hash(&self.keys.pubkeys().payment_point.serialize());
1477-
Builder::new().push_opcode(opcodes::all::OP_PUSHBYTES_0).push_slice(&payment_hash160[..]).into_script()
1478-
};
1479-
1480-
// Then, try to find htlc outputs
1481-
for (_, &(ref htlc, _)) in per_commitment_data.iter().enumerate() {
1525+
for (_, &(ref htlc, _)) in htlc_outputs.iter().enumerate() {
14821526
if let Some(transaction_output_index) = htlc.transaction_output_index {
1483-
if transaction_output_index as usize >= tx.output.len() ||
1484-
tx.output[transaction_output_index as usize].value != htlc.amount_msat / 1000 {
1485-
return (claimable_outpoints, (commitment_txid, watch_outputs)); // Corrupted per_commitment_data, fuck this user
1527+
if let Some(transaction) = tx {
1528+
if transaction_output_index as usize >= transaction.output.len() ||
1529+
transaction.output[transaction_output_index as usize].value != htlc.amount_msat / 1000 {
1530+
return claims; // Corrupted per_commitment_data, fuck this user
1531+
}
14861532
}
1487-
let preimage = if htlc.offered { if let Some(p) = self.payment_preimages.get(&htlc.payment_hash) { Some(*p) } else { None } } else { None };
1533+
let preimage =
1534+
if htlc.offered {
1535+
if let Some(p) = self.payment_preimages.get(&htlc.payment_hash) {
1536+
Some(*p)
1537+
} else { None }
1538+
} else { None };
14881539
let aggregable = if !htlc.offered { false } else { true };
14891540
if preimage.is_some() || !htlc.offered {
14901541
let witness_data = InputMaterial::CounterpartyHTLC { per_commitment_point: *revocation_point, counterparty_delayed_payment_base_key: self.counterparty_tx_cache.counterparty_delayed_payment_base_key, counterparty_htlc_base_key: self.counterparty_tx_cache.counterparty_htlc_base_key, preimage, htlc: htlc.clone() };
1491-
claimable_outpoints.push(ClaimRequest { absolute_timelock: htlc.cltv_expiry, aggregable, outpoint: BitcoinOutPoint { txid: commitment_txid, vout: transaction_output_index }, witness_data });
1542+
claims.push(ClaimRequest { absolute_timelock: htlc.cltv_expiry, aggregable, outpoint: BitcoinOutPoint { txid: commitment_txid, vout: transaction_output_index }, witness_data });
14921543
}
14931544
}
14941545
}
14951546
}
14961547
}
14971548
}
1498-
(claimable_outpoints, (commitment_txid, watch_outputs))
1549+
claims
14991550
}
15001551

15011552
/// Attempts to claim a counterparty HTLC-Success/HTLC-Timeout's outputs using the revocation key
@@ -1816,7 +1867,7 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
18161867
}
18171868
}
18181869

1819-
self.onchain_tx_handler.block_connected(&txn_matched, claimable_outpoints, height, &*broadcaster, &*fee_estimator, &*logger);
1870+
self.onchain_tx_handler.update_claims_view(&txn_matched, claimable_outpoints, Some(height), &&*broadcaster, &&*fee_estimator, &&*logger);
18201871
self.last_block_hash = block_hash;
18211872

18221873
// Determine new outputs to watch by comparing against previously known outputs to watch,

lightning/src/ln/functional_tests.rs

Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8503,3 +8503,187 @@ fn test_htlc_no_detection() {
85038503
connect_blocks(&nodes[0], ANTI_REORG_DELAY - 1, 201, true, header_201.block_hash());
85048504
expect_payment_failed!(nodes[0], our_payment_hash, true);
85058505
}
8506+
8507+
fn do_test_onchain_htlc_settlement_after_close(broadcast_alice: bool, go_onchain_before_fulfill: bool) {
8508+
// If we route an HTLC, then learn the HTLC's preimage after the upstream channel has been
8509+
// force-closed, we must claim that HTLC on-chain. (Given an HTLC forwarded from Alice --> Bob -->
8510+
// Carol, Alice would be the upstream node, and Carol the downstream.)
8511+
//
8512+
// Steps of the test:
8513+
// 1) Alice sends a HTLC to Carol through Bob.
8514+
// 2) Carol doesn't settle the HTLC.
8515+
// 3) If broadcast_alice is true, Alice force-closes her channel with Bob. Else Bob force closes.
8516+
// Steps 4 and 5 may be reordered depending on go_onchain_before_fulfill.
8517+
// 4) Bob sees the Alice's commitment on his chain or vice versa. An offered output is present
8518+
// but can't be claimed as Bob doesn't have yet knowledge of the preimage.
8519+
// 5) Carol release the preimage to Bob off-chain.
8520+
// 6) Bob claims the offered output on the broadcasted commitment.
8521+
let chanmon_cfgs = create_chanmon_cfgs(3);
8522+
let node_cfgs = create_node_cfgs(3, &chanmon_cfgs);
8523+
let node_chanmgrs = create_node_chanmgrs(3, &node_cfgs, &[None, None, None]);
8524+
let nodes = create_network(3, &node_cfgs, &node_chanmgrs);
8525+
8526+
// Create some initial channels
8527+
let chan_ab = create_announced_chan_between_nodes_with_value(&nodes, 0, 1, 100000, 10001, InitFeatures::known(), InitFeatures::known());
8528+
create_announced_chan_between_nodes_with_value(&nodes, 1, 2, 100000, 10001, InitFeatures::known(), InitFeatures::known());
8529+
8530+
// Steps (1) and (2):
8531+
// Send an HTLC Alice --> Bob --> Carol, but Carol doesn't settle the HTLC back.
8532+
let (payment_preimage, _payment_hash) = route_payment(&nodes[0], &vec!(&nodes[1], &nodes[2]), 3_000_000);
8533+
8534+
// Check that Alice's commitment transaction now contains an output for this HTLC.
8535+
let alice_txn = get_local_commitment_txn!(nodes[0], chan_ab.2);
8536+
check_spends!(alice_txn[0], chan_ab.3);
8537+
assert_eq!(alice_txn[0].output.len(), 2);
8538+
check_spends!(alice_txn[1], alice_txn[0]); // 2nd transaction is a non-final HTLC-timeout
8539+
assert_eq!(alice_txn[1].input[0].witness.last().unwrap().len(), OFFERED_HTLC_SCRIPT_WEIGHT);
8540+
assert_eq!(alice_txn.len(), 2);
8541+
8542+
// Steps (3) and (4):
8543+
// If `go_onchain_before_fufill`, broadcast the relevant commitment transaction and check that Bob
8544+
// responds by (1) broadcasting a channel update and (2) adding a new ChannelMonitor.
8545+
let mut force_closing_node = 0; // Alice force-closes
8546+
if !broadcast_alice { force_closing_node = 1; } // Bob force-closes
8547+
nodes[force_closing_node].node.force_close_channel(&chan_ab.2);
8548+
check_closed_broadcast!(nodes[force_closing_node], false);
8549+
check_added_monitors!(nodes[force_closing_node], 1);
8550+
if go_onchain_before_fulfill {
8551+
let txn_to_broadcast = match broadcast_alice {
8552+
true => alice_txn.clone(),
8553+
false => get_local_commitment_txn!(nodes[1], chan_ab.2)
8554+
};
8555+
let header = BlockHeader { version: 0x20000000, prev_blockhash: Default::default(), merkle_root: Default::default(), time: 42, bits: 42, nonce: 42};
8556+
connect_block(&nodes[1], &Block { header, txdata: vec![txn_to_broadcast[0].clone()]}, 1);
8557+
let mut bob_txn = nodes[1].tx_broadcaster.txn_broadcasted.lock().unwrap();
8558+
if broadcast_alice {
8559+
check_closed_broadcast!(nodes[1], false);
8560+
check_added_monitors!(nodes[1], 1);
8561+
}
8562+
assert_eq!(bob_txn.len(), 1);
8563+
check_spends!(bob_txn[0], chan_ab.3);
8564+
}
8565+
8566+
// Step (5):
8567+
// Carol then claims the funds and sends an update_fulfill message to Bob, and they go through the
8568+
// process of removing the HTLC from their commitment transactions.
8569+
assert!(nodes[2].node.claim_funds(payment_preimage, &None, 3_000_000));
8570+
check_added_monitors!(nodes[2], 1);
8571+
let carol_updates = get_htlc_update_msgs!(nodes[2], nodes[1].node.get_our_node_id());
8572+
assert!(carol_updates.update_add_htlcs.is_empty());
8573+
assert!(carol_updates.update_fail_htlcs.is_empty());
8574+
assert!(carol_updates.update_fail_malformed_htlcs.is_empty());
8575+
assert!(carol_updates.update_fee.is_none());
8576+
assert_eq!(carol_updates.update_fulfill_htlcs.len(), 1);
8577+
8578+
nodes[1].node.handle_update_fulfill_htlc(&nodes[2].node.get_our_node_id(), &carol_updates.update_fulfill_htlcs[0]);
8579+
// If Alice broadcasted but Bob doesn't know yet, here he prepares to tell her about the preimage.
8580+
if !go_onchain_before_fulfill && broadcast_alice {
8581+
let events = nodes[1].node.get_and_clear_pending_msg_events();
8582+
assert_eq!(events.len(), 1);
8583+
match events[0] {
8584+
MessageSendEvent::UpdateHTLCs { ref node_id, .. } => {
8585+
assert_eq!(*node_id, nodes[0].node.get_our_node_id());
8586+
},
8587+
_ => panic!("Unexpected event"),
8588+
};
8589+
}
8590+
nodes[1].node.handle_commitment_signed(&nodes[2].node.get_our_node_id(), &carol_updates.commitment_signed);
8591+
// One monitor update for the preimage to update the Bob<->Alice channel, one monitor update
8592+
// Carol<->Bob's updated commitment transaction info.
8593+
check_added_monitors!(nodes[1], 2);
8594+
8595+
let events = nodes[1].node.get_and_clear_pending_msg_events();
8596+
assert_eq!(events.len(), 2);
8597+
let bob_revocation = match events[0] {
8598+
MessageSendEvent::SendRevokeAndACK { ref node_id, ref msg } => {
8599+
assert_eq!(*node_id, nodes[2].node.get_our_node_id());
8600+
(*msg).clone()
8601+
},
8602+
_ => panic!("Unexpected event"),
8603+
};
8604+
let bob_updates = match events[1] {
8605+
MessageSendEvent::UpdateHTLCs { ref node_id, ref updates } => {
8606+
assert_eq!(*node_id, nodes[2].node.get_our_node_id());
8607+
(*updates).clone()
8608+
},
8609+
_ => panic!("Unexpected event"),
8610+
};
8611+
8612+
nodes[2].node.handle_revoke_and_ack(&nodes[1].node.get_our_node_id(), &bob_revocation);
8613+
check_added_monitors!(nodes[2], 1);
8614+
nodes[2].node.handle_commitment_signed(&nodes[1].node.get_our_node_id(), &bob_updates.commitment_signed);
8615+
check_added_monitors!(nodes[2], 1);
8616+
8617+
let events = nodes[2].node.get_and_clear_pending_msg_events();
8618+
assert_eq!(events.len(), 1);
8619+
let carol_revocation = match events[0] {
8620+
MessageSendEvent::SendRevokeAndACK { ref node_id, ref msg } => {
8621+
assert_eq!(*node_id, nodes[1].node.get_our_node_id());
8622+
(*msg).clone()
8623+
},
8624+
_ => panic!("Unexpected event"),
8625+
};
8626+
nodes[1].node.handle_revoke_and_ack(&nodes[2].node.get_our_node_id(), &carol_revocation);
8627+
check_added_monitors!(nodes[1], 1);
8628+
8629+
// If this test requires the force-closed channel to not be on-chain until after the fulfill,
8630+
// here's where we put said channel's commitment tx on-chain.
8631+
let mut txn_to_broadcast = alice_txn.clone();
8632+
if !broadcast_alice { txn_to_broadcast = get_local_commitment_txn!(nodes[1], chan_ab.2); }
8633+
if !go_onchain_before_fulfill {
8634+
let header = BlockHeader { version: 0x20000000, prev_blockhash: Default::default(), merkle_root: Default::default(), time: 42, bits: 42, nonce: 42};
8635+
connect_block(&nodes[1], &Block { header, txdata: vec![txn_to_broadcast[0].clone()]}, 1);
8636+
// If Bob was the one to force-close, he will have already passed these checks earlier.
8637+
if broadcast_alice {
8638+
check_closed_broadcast!(nodes[1], false);
8639+
check_added_monitors!(nodes[1], 1);
8640+
}
8641+
let mut bob_txn = nodes[1].tx_broadcaster.txn_broadcasted.lock().unwrap();
8642+
if broadcast_alice {
8643+
// In `connect_block()`, the ChainMonitor and ChannelManager are separately notified about a
8644+
// new block being connected. The ChannelManager being notified triggers a monitor update,
8645+
// which triggers broadcasting our commitment tx and an HTLC-claiming tx. The ChainMonitor
8646+
// being notified triggers the HTLC-claiming tx redundantly, resulting in 3 total txs being
8647+
// broadcasted.
8648+
assert_eq!(bob_txn.len(), 3);
8649+
check_spends!(bob_txn[1], chan_ab.3);
8650+
} else {
8651+
assert_eq!(bob_txn.len(), 2);
8652+
check_spends!(bob_txn[0], chan_ab.3);
8653+
}
8654+
}
8655+
8656+
// Step (6):
8657+
// Finally, check that Bob broadcasted a preimage-claiming transaction for the HTLC output on the
8658+
// broadcasted commitment transaction.
8659+
{
8660+
let bob_txn = nodes[1].tx_broadcaster.txn_broadcasted.lock().unwrap().clone();
8661+
if go_onchain_before_fulfill {
8662+
// Bob should now have an extra broadcasted tx, for the preimage-claiming transaction.
8663+
assert_eq!(bob_txn.len(), 2);
8664+
}
8665+
let script_weight = match broadcast_alice {
8666+
true => OFFERED_HTLC_SCRIPT_WEIGHT,
8667+
false => ACCEPTED_HTLC_SCRIPT_WEIGHT
8668+
};
8669+
// If Alice force-closed and Bob didn't receive her commitment transaction until after he
8670+
// received Carol's fulfill, he broadcasts the HTLC-output-claiming transaction first. Else if
8671+
// Bob force closed or if he found out about Alice's commitment tx before receiving Carol's
8672+
// fulfill, then he broadcasts the HTLC-output-claiming transaction second.
8673+
if broadcast_alice && !go_onchain_before_fulfill {
8674+
check_spends!(bob_txn[0], txn_to_broadcast[0]);
8675+
assert_eq!(bob_txn[0].input[0].witness.last().unwrap().len(), script_weight);
8676+
} else {
8677+
check_spends!(bob_txn[1], txn_to_broadcast[0]);
8678+
assert_eq!(bob_txn[1].input[0].witness.last().unwrap().len(), script_weight);
8679+
}
8680+
}
8681+
}
8682+
8683+
#[test]
8684+
fn test_onchain_htlc_settlement_after_close() {
8685+
do_test_onchain_htlc_settlement_after_close(true, true);
8686+
do_test_onchain_htlc_settlement_after_close(false, true); // Technically redundant, but may as well
8687+
do_test_onchain_htlc_settlement_after_close(true, false);
8688+
do_test_onchain_htlc_settlement_after_close(false, false);
8689+
}

lightning/src/ln/onchaintx.rs

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,8 @@ pub struct OnchainTxHandler<ChanSigner: ChannelKeys> {
282282

283283
onchain_events_waiting_threshold_conf: HashMap<u32, Vec<OnchainEvent>>,
284284

285+
latest_height: u32,
286+
285287
secp_ctx: Secp256k1<secp256k1::All>,
286288
}
287289

@@ -328,6 +330,7 @@ impl<ChanSigner: ChannelKeys + Writeable> OnchainTxHandler<ChanSigner> {
328330
}
329331
}
330332
}
333+
self.latest_height.write(writer)?;
331334
Ok(())
332335
}
333336
}
@@ -387,6 +390,7 @@ impl<ChanSigner: ChannelKeys + Readable> Readable for OnchainTxHandler<ChanSigne
387390
}
388391
onchain_events_waiting_threshold_conf.insert(height_target, events);
389392
}
393+
let latest_height = Readable::read(reader)?;
390394

391395
Ok(OnchainTxHandler {
392396
destination_script,
@@ -399,6 +403,7 @@ impl<ChanSigner: ChannelKeys + Readable> Readable for OnchainTxHandler<ChanSigne
399403
claimable_outpoints,
400404
pending_claim_requests,
401405
onchain_events_waiting_threshold_conf,
406+
latest_height,
402407
secp_ctx: Secp256k1::new(),
403408
})
404409
}
@@ -420,6 +425,7 @@ impl<ChanSigner: ChannelKeys> OnchainTxHandler<ChanSigner> {
420425
pending_claim_requests: HashMap::new(),
421426
claimable_outpoints: HashMap::new(),
422427
onchain_events_waiting_threshold_conf: HashMap::new(),
428+
latest_height: 0,
423429

424430
secp_ctx: Secp256k1::new(),
425431
}
@@ -471,7 +477,7 @@ impl<ChanSigner: ChannelKeys> OnchainTxHandler<ChanSigner> {
471477

472478
/// Lightning security model (i.e being able to redeem/timeout HTLC or penalize coutnerparty onchain) lays on the assumption of claim transactions getting confirmed before timelock expiration
473479
/// (CSV or CLTV following cases). In case of high-fee spikes, claim tx may stuck in the mempool, so you need to bump its feerate quickly using Replace-By-Fee or Child-Pay-For-Parent.
474-
fn generate_claim_tx<F: Deref, L: Deref>(&mut self, height: u32, cached_claim_datas: &ClaimTxBumpMaterial, fee_estimator: F, logger: L) -> Option<(Option<u32>, u32, Transaction)>
480+
fn generate_claim_tx<F: Deref, L: Deref>(&mut self, height: u32, cached_claim_datas: &ClaimTxBumpMaterial, fee_estimator: &F, logger: &L) -> Option<(Option<u32>, u32, Transaction)>
475481
where F::Target: FeeEstimator,
476482
L::Target: Logger,
477483
{
@@ -657,12 +663,20 @@ impl<ChanSigner: ChannelKeys> OnchainTxHandler<ChanSigner> {
657663
None
658664
}
659665

660-
pub(crate) fn block_connected<B: Deref, F: Deref, L: Deref>(&mut self, txn_matched: &[&Transaction], claimable_outpoints: Vec<ClaimRequest>, height: u32, broadcaster: B, fee_estimator: F, logger: L)
666+
/// Upon channelmonitor.block_connected(..) or upon provision of a preimage on the forward link
667+
/// for this channel, provide new relevant on-chain transactions and/or new claim requests.
668+
/// Formerly this was named `block_connected`, but it is now also used for claiming an HTLC output
669+
/// if we receive a preimage after force-close.
670+
pub(crate) fn update_claims_view<B: Deref, F: Deref, L: Deref>(&mut self, txn_matched: &[&Transaction], claimable_outpoints: Vec<ClaimRequest>, latest_height: Option<u32>, broadcaster: &B, fee_estimator: &F, logger: &L)
661671
where B::Target: BroadcasterInterface,
662672
F::Target: FeeEstimator,
663673
L::Target: Logger,
664674
{
665-
log_trace!(logger, "Block at height {} connected with {} claim requests", height, claimable_outpoints.len());
675+
let height = match latest_height {
676+
Some(h) => h,
677+
None => self.latest_height,
678+
};
679+
log_trace!(logger, "Updating claims view at height {} with {} matched transactions and {} claim requests", height, txn_matched.len(), claimable_outpoints.len());
666680
let mut new_claims = Vec::new();
667681
let mut aggregated_claim = HashMap::new();
668682
let mut aggregated_soonest = ::std::u32::MAX;
@@ -855,7 +869,7 @@ impl<ChanSigner: ChannelKeys> OnchainTxHandler<ChanSigner> {
855869
}
856870
}
857871
for (_, claim_material) in bump_candidates.iter_mut() {
858-
if let Some((new_timer, new_feerate, bump_tx)) = self.generate_claim_tx(height, &claim_material, &*fee_estimator, &*logger) {
872+
if let Some((new_timer, new_feerate, bump_tx)) = self.generate_claim_tx(height, &claim_material, &&*fee_estimator, &&*logger) {
859873
claim_material.height_timer = new_timer;
860874
claim_material.feerate_previous = new_feerate;
861875
broadcaster.broadcast_transaction(&bump_tx);

0 commit comments

Comments
 (0)