Skip to content

Commit 1e49c4a

Browse files
authored
Merge pull request #3096 from alecchendev/2024-06-drop-one-signer-call
Cache commitment point on ExternalHTLCClaim to drop a signer call
2 parents 9789152 + 4c1638c commit 1e49c4a

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

lightning/src/chain/channelmonitor.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3105,9 +3105,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
31053105
},
31063106
commitment_txid: htlc.commitment_txid,
31073107
per_commitment_number: htlc.per_commitment_number,
3108-
per_commitment_point: self.onchain_tx_handler.signer.get_per_commitment_point(
3109-
htlc.per_commitment_number, &self.onchain_tx_handler.secp_ctx,
3110-
),
3108+
per_commitment_point: htlc.per_commitment_point,
31113109
feerate_per_kw: 0,
31123110
htlc: htlc.htlc,
31133111
preimage: htlc.preimage,

lightning/src/chain/onchaintx.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ use bitcoin::blockdata::script::{Script, ScriptBuf};
2020
use bitcoin::hashes::{Hash, HashEngine};
2121
use bitcoin::hashes::sha256::Hash as Sha256;
2222
use bitcoin::hash_types::{Txid, BlockHash};
23+
use bitcoin::secp256k1::PublicKey;
2324
use bitcoin::secp256k1::{Secp256k1, ecdsa::Signature};
2425
use bitcoin::secp256k1;
2526

@@ -180,6 +181,7 @@ pub(crate) struct ExternalHTLCClaim {
180181
pub(crate) htlc: HTLCOutputInCommitment,
181182
pub(crate) preimage: Option<PaymentPreimage>,
182183
pub(crate) counterparty_sig: Signature,
184+
pub(crate) per_commitment_point: PublicKey,
183185
}
184186

185187
// Represents the different types of claims for which events are yielded externally to satisfy said
@@ -1231,6 +1233,7 @@ impl<ChannelSigner: EcdsaChannelSigner> OnchainTxHandler<ChannelSigner> {
12311233
htlc: htlc.clone(),
12321234
preimage: *preimage,
12331235
counterparty_sig: counterparty_htlc_sig,
1236+
per_commitment_point: trusted_tx.per_commitment_point(),
12341237
}
12351238
})
12361239
};

0 commit comments

Comments
 (0)