Skip to content

Commit 63612e4

Browse files
author
Antoine Riard
committed
Add log_trace on bump candidates tracking-buffer insertions
1 parent 993505c commit 63612e4

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/ln/channelmonitor.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1379,6 +1379,7 @@ impl ChannelMonitor {
13791379
let sighash_parts = bip143::SighashComponents::new(&single_htlc_tx);
13801380
let (redeemscript, revocation_key) = sign_input!(sighash_parts, single_htlc_tx.input[0], Some(idx), htlc.amount_msat / 1000);
13811381
assert!(predicted_weight >= single_htlc_tx.get_weight());
1382+
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.vout, single_htlc_tx.input[0].previous_output.txid, height_timer);
13821383
match self.our_claim_txn_waiting_first_conf.entry(single_htlc_tx.input[0].previous_output.clone()) {
13831384
hash_map::Entry::Occupied(_) => {},
13841385
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)); }
@@ -1459,6 +1460,7 @@ impl ChannelMonitor {
14591460
for (input, info) in spend_tx.input.iter_mut().zip(inputs_info.iter()) {
14601461
let (redeemscript, revocation_key) = sign_input!(sighash_parts, input, info.0, info.1);
14611462
let height_timer = Self::get_height_timer(height, info.2);
1463+
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.vout, input.previous_output.txid, height_timer);
14621464
match self.our_claim_txn_waiting_first_conf.entry(input.previous_output.clone()) {
14631465
hash_map::Entry::Occupied(_) => {},
14641466
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)); }
@@ -1648,6 +1650,7 @@ impl ChannelMonitor {
16481650
outpoint: BitcoinOutPoint { txid: single_htlc_tx.txid(), vout: 0 },
16491651
output: single_htlc_tx.output[0].clone(),
16501652
});
1653+
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.vout, single_htlc_tx.input[0].previous_output.txid, height_timer);
16511654
match self.our_claim_txn_waiting_first_conf.entry(single_htlc_tx.input[0].previous_output.clone()) {
16521655
hash_map::Entry::Occupied(_) => {},
16531656
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)); }
@@ -1685,6 +1688,7 @@ impl ChannelMonitor {
16851688
let (redeemscript, htlc_key) = sign_input!(sighash_parts, timeout_tx.input[0], htlc.amount_msat / 1000, vec![0]);
16861689
assert!(predicted_weight >= timeout_tx.get_weight());
16871690
//TODO: track SpendableOutputDescriptor
1691+
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.vout, timeout_tx.input[0].previous_output.txid, height_timer);
16881692
match self.our_claim_txn_waiting_first_conf.entry(timeout_tx.input[0].previous_output.clone()) {
16891693
hash_map::Entry::Occupied(_) => {},
16901694
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)); }
@@ -1720,6 +1724,7 @@ impl ChannelMonitor {
17201724
for (input, info) in spend_tx.input.iter_mut().zip(inputs_info.iter()) {
17211725
let (redeemscript, htlc_key) = sign_input!(sighash_parts, input, info.1, (info.0).0.to_vec());
17221726
let height_timer = Self::get_height_timer(height, info.2);
1727+
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.vout, input.previous_output.txid, height_timer);
17231728
match self.our_claim_txn_waiting_first_conf.entry(input.previous_output.clone()) {
17241729
hash_map::Entry::Occupied(_) => {},
17251730
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)); }
@@ -1827,6 +1832,7 @@ impl ChannelMonitor {
18271832
let outpoint = BitcoinOutPoint { txid: spend_tx.txid(), vout: 0 };
18281833
let output = spend_tx.output[0].clone();
18291834
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
1835+
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.vout, spend_tx.input[0].previous_output.txid, height_timer);
18301836
match self.our_claim_txn_waiting_first_conf.entry(spend_tx.input[0].previous_output.clone()) {
18311837
hash_map::Entry::Occupied(_) => {},
18321838
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)); }
@@ -1959,6 +1965,7 @@ impl ChannelMonitor {
19591965
spendable_outputs.append(&mut $updates.1);
19601966
watch_outputs.append(&mut $updates.2);
19611967
for claim in $updates.3 {
1968+
log_trace!(self, "Outpoint {}:{} is under claiming process, if it doesn't succeed, a bumped claiming txn is going to be broadcast at height {}", (claim.0).vout, (claim.0).txid, (claim.1).0);
19621969
match self.our_claim_txn_waiting_first_conf.entry(claim.0) {
19631970
hash_map::Entry::Occupied(_) => {},
19641971
hash_map::Entry::Vacant(entry) => { entry.insert(claim.1); }
@@ -2182,6 +2189,7 @@ impl ChannelMonitor {
21822189
}
21832190
}
21842191
for claim in pending_claims {
2192+
log_trace!(self, "Outpoint {}:{} is under claiming process, if it doesn't succeed, a bumped claiming txn is going to be broadcast at height {}", (claim.0).vout, (claim.0).txid, (claim.1).0);
21852193
match self.our_claim_txn_waiting_first_conf.entry(claim.0) {
21862194
hash_map::Entry::Occupied(_) => {},
21872195
hash_map::Entry::Vacant(entry) => { entry.insert(claim.1); }

0 commit comments

Comments
 (0)