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
send warning when we receive a old commitment transaction
During a `channel_restablish` now we send a warning message when we we receive a old commitment transaction from the peer
Signed-off-by: Vincenzo Palazzo <[email protected]>
let _our_commitment_transaction = INITIAL_COMMITMENT_NUMBER - self.cur_holder_commitment_transaction_number - 1;
3688
+
if msg.next_remote_commitment_number + 1 < _our_commitment_transaction {
3689
+
returnErr(
3690
+
ChannelError::Warn(format!("Peer attempted to reestablish channel with a very old local commitment transaction: {} (received) vs {} (expected)", msg.next_remote_commitment_number, _our_commitment_transaction))
3691
+
);
3692
+
}
3693
+
Ok(())
3694
+
}
3695
+
3682
3696
/// May panic if some calls other than message-handling calls (which will all Err immediately)
3683
3697
/// have been called between remove_uncommitted_htlcs_and_mark_paused and this call.
if expected_point != PublicKey::from_secret_key(&self.secp_ctx,&given_secret){
3706
3720
returnErr(ChannelError::Close("Peer sent a garbage channel_reestablish with secret key not matching the commitment height provided".to_owned()));
3707
3721
}
3722
+
3708
3723
if msg.next_remote_commitment_number > INITIAL_COMMITMENT_NUMBER - self.cur_holder_commitment_transaction_number{
3709
3724
returnErr(ChannelError::CloseDelayBroadcast(
3710
3725
"We have fallen behind - we have received proof that if we broadcast remote is going to claim our funds - we can't do any automated broadcasting".to_owned()
0 commit comments