From: Alec Chen Date: Wed, 5 Jun 2024 21:08:41 +0000 (-0500) Subject: Cache commitment point on ExternalHTLCClaim to drop a signer call X-Git-Tag: v0.0.124-beta~94^2 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=4c1638c55ee95a4800edbb4fcfb650a3301d51cb;p=rust-lightning Cache commitment point on ExternalHTLCClaim to drop a signer call --- diff --git a/lightning/src/chain/channelmonitor.rs b/lightning/src/chain/channelmonitor.rs index 3ca15e483..3a2892269 100644 --- a/lightning/src/chain/channelmonitor.rs +++ b/lightning/src/chain/channelmonitor.rs @@ -3104,9 +3104,7 @@ impl ChannelMonitorImpl { }, commitment_txid: htlc.commitment_txid, per_commitment_number: htlc.per_commitment_number, - per_commitment_point: self.onchain_tx_handler.signer.get_per_commitment_point( - htlc.per_commitment_number, &self.onchain_tx_handler.secp_ctx, - ), + per_commitment_point: htlc.per_commitment_point, feerate_per_kw: 0, htlc: htlc.htlc, preimage: htlc.preimage, diff --git a/lightning/src/chain/onchaintx.rs b/lightning/src/chain/onchaintx.rs index f66258c2c..6bbd2439e 100644 --- a/lightning/src/chain/onchaintx.rs +++ b/lightning/src/chain/onchaintx.rs @@ -19,6 +19,7 @@ use bitcoin::blockdata::script::{Script, ScriptBuf}; use bitcoin::hashes::{Hash, HashEngine}; use bitcoin::hashes::sha256::Hash as Sha256; use bitcoin::hash_types::{Txid, BlockHash}; +use bitcoin::secp256k1::PublicKey; use bitcoin::secp256k1::{Secp256k1, ecdsa::Signature}; use bitcoin::secp256k1; @@ -179,6 +180,7 @@ pub(crate) struct ExternalHTLCClaim { pub(crate) htlc: HTLCOutputInCommitment, pub(crate) preimage: Option, pub(crate) counterparty_sig: Signature, + pub(crate) per_commitment_point: PublicKey, } // Represents the different types of claims for which events are yielded externally to satisfy said @@ -1230,6 +1232,7 @@ impl OnchainTxHandler { htlc: htlc.clone(), preimage: *preimage, counterparty_sig: counterparty_htlc_sig, + per_commitment_point: trusted_tx.per_commitment_point(), } }) };