From: Matt Corallo <649246+TheBlueMatt@users.noreply.github.com> Date: Tue, 11 Jun 2024 14:20:00 +0000 (-0700) Subject: Merge pull request #3037 from TheBlueMatt/2024-05-close-on-stale-fees X-Git-Tag: v0.0.124-beta~88 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=a6664010fd2603abc474cf80cf86a95d08578f65;p=rust-lightning Merge pull request #3037 from TheBlueMatt/2024-05-close-on-stale-fees Force-close channels if their feerate gets stale without any update --- a6664010fd2603abc474cf80cf86a95d08578f65 diff --cc lightning/src/ln/channel.rs index d6ab1876a,75d1c0949..57fbe5162 --- a/lightning/src/ln/channel.rs +++ b/lightning/src/ln/channel.rs @@@ -5365,10 -5323,10 +5396,10 @@@ impl Channel 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)