Skip to content

Commit 9d9cfe6

Browse files
committed
Add debug assertions on revoked counterparty tx number fetching
We actually store the latest counterparty revoked commitment transaction number in two places in `Channel` - as `context.cur_counterparty_commitment_transaction_number + 2` and in `commitment_secrets`. Here we add a debug assertion that both values are equal.
1 parent 8d86558 commit 9d9cfe6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lightning/src/ln/channel.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9608,7 +9608,9 @@ where
96089608
}
96099609

96109610
pub fn get_revoked_counterparty_commitment_transaction_number(&self) -> u64 {
9611-
self.context.cur_counterparty_commitment_transaction_number + 2
9611+
let ret = self.context.cur_counterparty_commitment_transaction_number + 2;
9612+
debug_assert_eq!(self.context.commitment_secrets.get_min_seen_secret(), ret);
9613+
ret
96129614
}
96139615

96149616
#[cfg(any(test, feature = "_externalize_tests"))]

0 commit comments

Comments
 (0)