Skip to content

Commit b8fe822

Browse files
committed
Expose TxCreationKeys in LocalCommitmentTransaction via a method
This makes it obvious to signer implementers that the pre-derived keys are a local cache and should not be trusted in a validating signer.
1 parent acb0cc4 commit b8fe822

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lightning/src/ln/chan_utils.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -540,8 +540,7 @@ pub struct LocalCommitmentTransaction {
540540
// Which order the signatures should go in when constructing the final commitment tx witness.
541541
// The user should be able to reconstruc this themselves, so we don't bother to expose it.
542542
our_sig_first: bool,
543-
/// The key derivation parameters for this commitment transaction
544-
pub local_keys: TxCreationKeys,
543+
pub(crate) local_keys: TxCreationKeys,
545544
/// The feerate paid per 1000-weight-unit in this commitment transaction. This value is
546545
/// controlled by the channel initiator.
547546
pub feerate_per_kw: u32,
@@ -606,6 +605,12 @@ impl LocalCommitmentTransaction {
606605
}
607606
}
608607

608+
/// The pre-calculated transaction creation public keys.
609+
/// An external validating signer should not trust these keys.
610+
pub fn trust_key_derivation(&self) -> &TxCreationKeys {
611+
&self.local_keys
612+
}
613+
609614
/// Get the txid of the local commitment transaction contained in this
610615
/// LocalCommitmentTransaction
611616
pub fn txid(&self) -> Txid {

0 commit comments

Comments
 (0)