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
Fix channel_reestablish exchanging in case of lost messages
This uses the new storage in HTLC state enums to reproduce the
various updates in a CommitmentUpdate group which is obviously
required to re-send a commitment_update after pending unreceived
updates were dropped.
Does not yet handle dropped update_fee updates properly.
let next_per_commitment_point = PublicKey::from_secret_key(&self.secp_ctx,&self.build_local_commitment_secret(self.cur_local_commitment_transaction_number));
2095
2095
let per_commitment_secret = chan_utils::build_commitment_secret(self.local_keys.commitment_seed,self.cur_local_commitment_transaction_number + 2);
2096
-
required_revoke = Some(msgs::RevokeAndACK{
2096
+
Some(msgs::RevokeAndACK{
2097
2097
channel_id:self.channel_id,
2098
2098
per_commitment_secret,
2099
2099
next_per_commitment_point,
2100
-
});
2100
+
})
2101
2101
}else{
2102
2102
returnErr(ChannelError::Close("Peer attempted to reestablish channel with a very old local commitment transaction"));
2103
-
}
2103
+
};
2104
2104
2105
-
if msg.next_local_commitment_number == INITIAL_COMMITMENT_NUMBER - self.cur_remote_commitment_transaction_number{
2106
-
if msg.next_remote_commitment_number == INITIAL_COMMITMENT_NUMBER - self.cur_local_commitment_transaction_number{
2107
-
log_debug!(self,"Reconnected channel {} with no lost commitment txn", log_bytes!(self.channel_id()));
2108
-
if msg.next_local_commitment_number == 1 && msg.next_remote_commitment_number == 1{
2109
-
let next_per_commitment_secret = self.build_local_commitment_secret(self.cur_local_commitment_transaction_number);
2110
-
let next_per_commitment_point = PublicKey::from_secret_key(&self.secp_ctx,&next_per_commitment_secret);
update_fee:None,//TODO: We need to support re-generating any update_fees in the last commitment_signed!
2147
2205
commitment_signed:self.send_commitment_no_state_update().expect("It looks like we failed to re-generate a commitment_signed we had previously sent?").0,
0 commit comments