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
returnErr(HandleError{err:"Peer sent a loose channel_reestablish not after reconnect",action:Some(msgs::ErrorAction::SendErrorMessage{msg: msgs::ErrorMessage{data:"Peer sent a loose channel_reestablish not after reconnect".to_string(),channel_id: msg.channel_id}})});
1909
+
}
1910
+
1911
+
if msg.next_local_commitment_number == 0 || msg.next_local_commitment_number >= 0xffffffffffff ||
let next_per_commitment_point = PublicKey::from_secret_key(&self.secp_ctx,&self.build_local_commitment_secret(self.cur_local_commitment_transaction_number));
1924
+
let per_commitment_secret = chan_utils::build_commitment_secret(self.local_keys.commitment_seed,self.cur_local_commitment_transaction_number + 2);
1925
+
required_revoke = Some(msgs::RevokeAndACK{
1926
+
channel_id:self.channel_id,
1927
+
per_commitment_secret,
1928
+
next_per_commitment_point,
1929
+
});
1930
+
}else{
1931
+
returnErr(HandleError{err:"Peer attempted to reestablish channel with a very old local commitment transaction",action:Some(msgs::ErrorAction::SendErrorMessage{msg: msgs::ErrorMessage{data:"Peer attempted to reestablish channel with a very old remote commitment transaction".to_string(),channel_id: msg.channel_id}})});
1932
+
}
1933
+
1934
+
if msg.next_local_commitment_number == 0xffffffffffff - self.cur_remote_commitment_transaction_number{
1935
+
if msg.next_remote_commitment_number == 0xffffffffffff - self.cur_local_commitment_transaction_number{
1936
+
log_debug!(self,"Reconnected channel {} with no lost commitment txn", log_bytes!(self.channel_id()));
1937
+
if msg.next_local_commitment_number == 1 && msg.next_remote_commitment_number == 1{
1938
+
let next_per_commitment_secret = self.build_local_commitment_secret(self.cur_local_commitment_transaction_number);
1939
+
let next_per_commitment_point = PublicKey::from_secret_key(&self.secp_ctx,&next_per_commitment_secret);
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,
1975
+
}),None));
1976
+
}else{
1977
+
returnErr(HandleError{err:"Peer attempted to reestablish channel with a very old remote commitment transaction",action:Some(msgs::ErrorAction::SendErrorMessage{msg: msgs::ErrorMessage{data:"Peer attempted to reestablish channel with a very old remote commitment transaction".to_string(),channel_id: msg.channel_id}})});
returnErr(HandleError{err:"Peer sent shutdown when we needed a channel_reestablish",action:Some(msgs::ErrorAction::SendErrorMessage{msg: msgs::ErrorMessage{data:"Peer sent shutdown when we needed a channel_reestablish".to_string(),channel_id: msg.channel_id}})});
@@ -2167,6 +2250,11 @@ impl Channel {
2167
2250
res asu32
2168
2251
}
2169
2252
2253
+
/// Returns true if we've ever received a message from the remote end for this Channel
@@ -2156,7 +2176,7 @@ impl ChannelMessageHandler for ChannelManager {
2156
2176
channel_state.by_id.retain(|_, chan| {
2157
2177
if chan.get_their_node_id() == *their_node_id {
2158
2178
//TODO: mark channel disabled (and maybe announce such after a timeout).
2159
-
let failed_adds = chan.remove_uncommitted_htlcs();
2179
+
let failed_adds = chan.remove_uncommitted_htlcs_and_mark_paused();
2160
2180
if !failed_adds.is_empty(){
2161
2181
let chan_update = self.get_channel_update(&chan).map(|u| u.encode_with_len()).unwrap();// Cannot add/recv HTLCs before we have a short_id so unwrap is safe
2162
2182
failed_payments.push((chan_update, failed_adds));
@@ -2188,8 +2208,25 @@ impl ChannelMessageHandler for ChannelManager {
0 commit comments