You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/ln/channel.rs
+24Lines changed: 24 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -774,6 +774,8 @@ impl Channel {
774
774
letmut local_htlc_total_msat = 0;
775
775
letmut value_to_self_msat_offset = 0;
776
776
777
+
log_trace!(self,"Building commitment transaction number {} for {}, generated by {} with fee {}...", commitment_number,if local {"us"} else {"remote"},if generated_by_local {"us"} else {"remote"}, feerate_per_kw);
778
+
777
779
macro_rules! get_htlc_in_commitment {
778
780
($htlc: expr, $offered: expr) => {
779
781
HTLCOutputInCommitment{
@@ -791,21 +793,25 @@ impl Channel {
791
793
if $outbound == local {// "offered HTLC output"
792
794
let htlc_in_tx = get_htlc_in_commitment!($htlc,true);
log_trace!(self," ...not including {} HTLC {} with value {} due to dust limit",if $outbound {"outbound"} else {"inbound"}, log_bytes!($htlc.payment_hash.0), $htlc.amount_msat);
799
803
included_dust_htlcs.push((htlc_in_tx, $source));
800
804
}
801
805
} else {
802
806
let htlc_in_tx = get_htlc_in_commitment!($htlc,false);
log_trace!(self," ...not including {} HTLC {} with value {} due to dust limit",if $outbound {"outbound"} else {"inbound"}, log_bytes!($htlc.payment_hash.0), $htlc.amount_msat);
809
815
included_dust_htlcs.push((htlc_in_tx, $source));
810
816
}
811
817
}
@@ -825,6 +831,13 @@ impl Channel {
825
831
add_htlc_output!(htlc,false,None);
826
832
remote_htlc_total_msat += htlc.amount_msat;
827
833
}else{
834
+
log_trace!(self," ...not including inbound HTLC {} with value {} due to state ({})", log_bytes!(htlc.payment_hash.0), htlc.amount_msat,match htlc.state {
log_trace!(self," ...not including outbound HTLC {} with value {} due to state ({})", log_bytes!(htlc.payment_hash.0), htlc.amount_msat,match htlc.state {
let local_commitment_txid = local_commitment_tx.0.txid();
1697
1717
let local_sighash = Message::from_slice(&bip143::SighashComponents::new(&local_commitment_tx.0).sighash_all(&local_commitment_tx.0.input[0],&funding_script,self.channel_value_satoshis)[..]).unwrap();
1718
+
log_trace!(self,"Checking commitment tx signature {} by key {} against tx {} with redeemscript {}", log_bytes!(msg.signature[..]), log_bytes!(self.their_funding_pubkey.unwrap().serialize()), encode::serialize_hex(&local_commitment_tx.0), encode::serialize_hex(&funding_script));
1698
1719
secp_check!(self.secp_ctx.verify(&local_sighash,&msg.signature,&self.their_funding_pubkey.unwrap()),"Invalid commitment tx signature from peer");
1699
1720
1700
1721
//If channel fee was updated by funder confirm funder can afford the new fee rate when applied to the current local commitment transaction
let htlc_redeemscript = chan_utils::get_htlc_redeemscript(&htlc,&local_keys);
1744
+
log_trace!(self,"Checking HTLC tx signature {} by key {} against tx {} with redeemscript {}", log_bytes!(msg.htlc_signatures[idx][..]), log_bytes!(local_keys.b_htlc_key.serialize()), encode::serialize_hex(&htlc_tx), encode::serialize_hex(&htlc_redeemscript));
1723
1745
let htlc_sighash = Message::from_slice(&bip143::SighashComponents::new(&htlc_tx).sighash_all(&htlc_tx.input[0],&htlc_redeemscript, htlc.amount_msat / 1000)[..]).unwrap();
1724
1746
secp_check!(self.secp_ctx.verify(&htlc_sighash,&msg.htlc_signatures[idx],&local_keys.b_htlc_key),"Invalid HTLC tx signature from peer");
1725
1747
let htlc_sig = if htlc.offered{
@@ -3285,6 +3307,7 @@ impl Channel {
3285
3307
let remote_commitment_txid = remote_commitment_tx.0.txid();
3286
3308
let remote_sighash = Message::from_slice(&bip143::SighashComponents::new(&remote_commitment_tx.0).sighash_all(&remote_commitment_tx.0.input[0],&funding_script,self.channel_value_satoshis)[..]).unwrap();
3287
3309
let our_sig = self.secp_ctx.sign(&remote_sighash,&self.local_keys.funding_key);
3310
+
log_trace!(self,"Signing commitment tx {} with redeemscript {} with pubkey {} -> {}", encode::serialize_hex(&remote_commitment_tx.0), encode::serialize_hex(&funding_script), log_bytes!(PublicKey::from_secret_key(&self.secp_ctx,&self.local_keys.funding_key).serialize()), log_bytes!(our_sig[..]));
0 commit comments