]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Merge pull request #3037 from TheBlueMatt/2024-05-close-on-stale-fees
authorMatt Corallo <649246+TheBlueMatt@users.noreply.github.com>
Tue, 11 Jun 2024 14:20:00 +0000 (07:20 -0700)
committerGitHub <noreply@github.com>
Tue, 11 Jun 2024 14:20:00 +0000 (07:20 -0700)
Force-close channels if their feerate gets stale without any update

1  2 
lightning/src/ln/channel.rs

index d6ab1876ae0a31af8dfacc5bac01e35ed438e008,75d1c0949e4fbd846e98a6641beddb663866ceae..57fbe51626bec580a111f62335dfdc63d70771d5
@@@ -5365,10 -5323,10 +5396,10 @@@ impl<SP: Deref> Channel<SP> wher
  
                if msg.next_local_commitment_number >= INITIAL_COMMITMENT_NUMBER || msg.next_remote_commitment_number >= INITIAL_COMMITMENT_NUMBER ||
                        msg.next_local_commitment_number == 0 {
-                       return Err(ChannelError::Close("Peer sent an invalid channel_reestablish to force close in a non-standard way".to_owned()));
+                       return Err(ChannelError::close("Peer sent an invalid channel_reestablish to force close in a non-standard way".to_owned()));
                }
  
 -              let our_commitment_transaction = INITIAL_COMMITMENT_NUMBER - self.context.cur_holder_commitment_transaction_number - 1;
 +              let our_commitment_transaction = INITIAL_COMMITMENT_NUMBER - self.context.holder_commitment_point.transaction_number() - 1;
                if msg.next_remote_commitment_number > 0 {
                        let expected_point = self.context.holder_signer.as_ref().get_per_commitment_point(INITIAL_COMMITMENT_NUMBER - msg.next_remote_commitment_number + 1, &self.context.secp_ctx);
                        let given_secret = SecretKey::from_slice(&msg.your_last_per_commitment_secret)