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: lightning/src/util/enforcing_trait_impls.rs
+12Lines changed: 12 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -117,12 +117,21 @@ impl BaseSign for EnforcingSigner {
117
117
// These commitment numbers are backwards counting. We expect either the same as the previously encountered,
118
118
// or the next one.
119
119
assert!(last_commitment_number == actual_commitment_number || last_commitment_number - 1 == actual_commitment_number,"{} doesn't come after {}", actual_commitment_number, last_commitment_number);
120
+
// Ensure that the counterparty doesn't get more than two broadcastable commitments -
121
+
// the last and the one we are trying to sign
122
+
assert!(actual_commitment_number >= state.last_counterparty_revoked_commitment - 2,"cannot sign a commitment if second to last wasn't revoked - signing {} revoked {}", actual_commitment_number, state.last_counterparty_revoked_commitment);
assert!(idx == state.last_counterparty_revoked_commitment || idx == state.last_counterparty_revoked_commitment - 1,"expecting to validate the current or next counterparty revocation - trying {}, current {}", idx, state.last_counterparty_revoked_commitment);
0 commit comments