Skip to content

Commit 928dda1

Browse files
author
Antoine Riard
committed
Add log_trace on bump candidates tracking-buffer insertions
1 parent 065d76e commit 928dda1

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/ln/channelmonitor.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1409,6 +1409,7 @@ impl ChannelMonitor {
14091409
let sighash_parts = bip143::SighashComponents::new(&single_htlc_tx);
14101410
let (redeemscript, revocation_key) = sign_input!(sighash_parts, single_htlc_tx.input[0], Some(idx), htlc.amount_msat / 1000);
14111411
assert!(predicted_weight >= single_htlc_tx.get_weight());
1412+
log_trace!(self, "Outpoint {}:{} is under claiming process, if it doesn't succeed, a bumped claiming txn is going to be broadcast at height {}", single_htlc_tx.input[0].previous_output.txid, single_htlc_tx.input[0].previous_output.vout, height_timer);
14121413
match self.our_claim_txn_waiting_first_conf.entry(single_htlc_tx.input[0].previous_output.clone()) {
14131414
hash_map::Entry::Occupied(_) => {},
14141415
hash_map::Entry::Vacant(entry) => { entry.insert((height_timer, TxMaterial::Revoked { script: redeemscript, pubkey: Some(revocation_pubkey), key: revocation_key, is_htlc: true, amount: htlc.amount_msat / 1000 }, used_feerate, htlc.cltv_expiry, height)); }
@@ -1489,6 +1490,7 @@ impl ChannelMonitor {
14891490
for (input, info) in spend_tx.input.iter_mut().zip(inputs_info.iter()) {
14901491
let (redeemscript, revocation_key) = sign_input!(sighash_parts, input, info.0, info.1);
14911492
let height_timer = Self::get_height_timer(height, info.2);
1493+
log_trace!(self, "Outpoint {}:{} is under claiming process, if it doesn't succeed, a bumped claiming txn is going to be broadcast at height {}", input.previous_output.txid, input.previous_output.vout, height_timer);
14921494
match self.our_claim_txn_waiting_first_conf.entry(input.previous_output.clone()) {
14931495
hash_map::Entry::Occupied(_) => {},
14941496
hash_map::Entry::Vacant(entry) => { entry.insert((height_timer, TxMaterial::Revoked { script: redeemscript, pubkey: if info.0.is_some() { Some(revocation_pubkey) } else { None }, key: revocation_key, is_htlc: if info.0.is_some() { true } else { false }, amount: info.1 }, used_feerate, if !info.0.is_some() { height + info.2 } else { info.2 }, height)); }
@@ -1678,6 +1680,7 @@ impl ChannelMonitor {
16781680
outpoint: BitcoinOutPoint { txid: single_htlc_tx.txid(), vout: 0 },
16791681
output: single_htlc_tx.output[0].clone(),
16801682
});
1683+
log_trace!(self, "Outpoint {}:{} is under claiming process, if it doesn't succeed, a bumped claiming txn is going to be broadcast at height {}", single_htlc_tx.input[0].previous_output.txid, single_htlc_tx.input[0].previous_output.vout, height_timer);
16811684
match self.our_claim_txn_waiting_first_conf.entry(single_htlc_tx.input[0].previous_output.clone()) {
16821685
hash_map::Entry::Occupied(_) => {},
16831686
hash_map::Entry::Vacant(entry) => { entry.insert((height_timer, TxMaterial::RemoteHTLC { script: redeemscript, key: htlc_key, preimage: Some(*payment_preimage), amount: htlc.amount_msat / 1000 }, used_feerate, htlc.cltv_expiry, height)); }
@@ -1715,6 +1718,7 @@ impl ChannelMonitor {
17151718
let (redeemscript, htlc_key) = sign_input!(sighash_parts, timeout_tx.input[0], htlc.amount_msat / 1000, vec![0]);
17161719
assert!(predicted_weight >= timeout_tx.get_weight());
17171720
//TODO: track SpendableOutputDescriptor
1721+
log_trace!(self, "Outpoint {}:{} is under claiming process, if it doesn't succeed, a bumped claiming txn is going to be broadcast at height {}", timeout_tx.input[0].previous_output.txid, timeout_tx.input[0].previous_output.vout, height_timer);
17181722
match self.our_claim_txn_waiting_first_conf.entry(timeout_tx.input[0].previous_output.clone()) {
17191723
hash_map::Entry::Occupied(_) => {},
17201724
hash_map::Entry::Vacant(entry) => { entry.insert((height_timer, TxMaterial::RemoteHTLC { script : redeemscript, key: htlc_key, preimage: None, amount: htlc.amount_msat / 1000 }, used_feerate, htlc.cltv_expiry, height)); }
@@ -1750,6 +1754,7 @@ impl ChannelMonitor {
17501754
for (input, info) in spend_tx.input.iter_mut().zip(inputs_info.iter()) {
17511755
let (redeemscript, htlc_key) = sign_input!(sighash_parts, input, info.1, (info.0).0.to_vec());
17521756
let height_timer = Self::get_height_timer(height, info.2);
1757+
log_trace!(self, "Outpoint {}:{} is under claiming process, if it doesn't succeed, a bumped claiming txn is going to be broadcast at height {}", input.previous_output.txid, input.previous_output.vout, height_timer);
17531758
match self.our_claim_txn_waiting_first_conf.entry(input.previous_output.clone()) {
17541759
hash_map::Entry::Occupied(_) => {},
17551760
hash_map::Entry::Vacant(entry) => { entry.insert((height_timer, TxMaterial::RemoteHTLC { script: redeemscript, key: htlc_key, preimage: Some(*(info.0)), amount: info.1}, used_feerate, info.2, height)); }
@@ -1867,6 +1872,7 @@ impl ChannelMonitor {
18671872
let outpoint = BitcoinOutPoint { txid: spend_tx.txid(), vout: 0 };
18681873
let output = spend_tx.output[0].clone();
18691874
let height_timer = Self::get_height_timer(height, self.their_to_self_delay.unwrap() as u32); // We can safely unwrap given we are past channel opening
1875+
log_trace!(self, "Outpoint {}:{} is under claiming process, if it doesn't succeed, a bumped claiming txn is going to be broadcast at height {}", spend_tx.input[0].previous_output.txid, spend_tx.input[0].previous_output.vout, height_timer);
18701876
match self.our_claim_txn_waiting_first_conf.entry(spend_tx.input[0].previous_output.clone()) {
18711877
hash_map::Entry::Occupied(_) => {},
18721878
hash_map::Entry::Vacant(entry) => { entry.insert((height_timer, TxMaterial::Revoked { script: redeemscript, pubkey: None, key: revocation_key, is_htlc: false, amount: tx.output[0].value }, used_feerate, height + self.our_to_self_delay as u32, height)); }

0 commit comments

Comments
 (0)