Skip to content

Commit 92bea25

Browse files
Antoine RiardTheBlueMatt
authored andcommitted
Add logging of HTLC outputs resolved by remote peer justice tx
In case of broadcast of revoked local commitment tx, we may be interested that we've screwed up
1 parent fdd5eda commit 92bea25

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/ln/channelmonitor.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1813,7 +1813,10 @@ impl ChannelMonitor {
18131813
// to broadcast solving backward
18141814
if let Some((source, payment_hash)) = payment_data {
18151815
let mut payment_preimage = PaymentPreimage([0; 32]);
1816-
if input.witness.len() == 5 && input.witness[4].len() == ACCEPTED_HTLC_SCRIPT_WEIGHT {
1816+
if (input.witness.len() == 3 && input.witness[2].len() == OFFERED_HTLC_SCRIPT_WEIGHT && input.witness[1].len() == 33)
1817+
|| (input.witness.len() == 3 && input.witness[2].len() == ACCEPTED_HTLC_SCRIPT_WEIGHT && input.witness[1].len() == 33) {
1818+
log_error!(self, "Remote used revocation sig to take a {} HTLC output at index {} from commitment_tx {}", if input.witness[2].len() == OFFERED_HTLC_SCRIPT_WEIGHT { "offered" } else { "accepted" }, input.previous_output.vout, input.previous_output.txid);
1819+
} else if input.witness.len() == 5 && input.witness[4].len() == ACCEPTED_HTLC_SCRIPT_WEIGHT {
18171820
payment_preimage.0.copy_from_slice(&tx.input[0].witness[3]);
18181821
htlc_updated.push((source, Some(payment_preimage), payment_hash));
18191822
} else if input.witness.len() == 3 && input.witness[2].len() == OFFERED_HTLC_SCRIPT_WEIGHT {

0 commit comments

Comments
 (0)