Skip to content

Commit 4c1638c

Browse files
committed
Cache commitment point on ExternalHTLCClaim to drop a signer call
1 parent df01208 commit 4c1638c

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
@@ -3104,9 +3104,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
31043104
},
31053105
commitment_txid: htlc.commitment_txid,
31063106
per_commitment_number: htlc.per_commitment_number,
3107-
per_commitment_point: self.onchain_tx_handler.signer.get_per_commitment_point(
3108-
htlc.per_commitment_number, &self.onchain_tx_handler.secp_ctx,
3109-
),
3107+
per_commitment_point: htlc.per_commitment_point,
31103108
feerate_per_kw: 0,
31113109
htlc: htlc.htlc,
31123110
preimage: htlc.preimage,

lightning/src/chain/onchaintx.rs

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

@@ -179,6 +180,7 @@ pub(crate) struct ExternalHTLCClaim {
179180
pub(crate) htlc: HTLCOutputInCommitment,
180181
pub(crate) preimage: Option<PaymentPreimage>,
181182
pub(crate) counterparty_sig: Signature,
183+
pub(crate) per_commitment_point: PublicKey,
182184
}
183185

184186
// Represents the different types of claims for which events are yielded externally to satisfy said
@@ -1230,6 +1232,7 @@ impl<ChannelSigner: EcdsaChannelSigner> OnchainTxHandler<ChannelSigner> {
12301232
htlc: htlc.clone(),
12311233
preimage: *preimage,
12321234
counterparty_sig: counterparty_htlc_sig,
1235+
per_commitment_point: trusted_tx.per_commitment_point(),
12331236
}
12341237
})
12351238
};

0 commit comments

Comments
 (0)