Skip to content

Commit 812d2d6

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 f5b594d commit 812d2d6

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
@@ -537,8 +537,7 @@ pub struct LocalCommitmentTransaction {
537537
// Which order the signatures should go in when constructing the final commitment tx witness.
538538
// The user should be able to reconstruc this themselves, so we don't bother to expose it.
539539
our_sig_first: bool,
540-
/// The key derivation parameters for this commitment transaction
541-
pub local_keys: TxCreationKeys,
540+
pub(crate) local_keys: TxCreationKeys,
542541
/// The feerate paid per 1000-weight-unit in this commitment transaction. This value is
543542
/// controlled by the channel initiator.
544543
pub feerate_per_kw: u32,
@@ -603,6 +602,12 @@ impl LocalCommitmentTransaction {
603602
}
604603
}
605604

605+
/// The pre-calculated transaction creation public keys.
606+
/// An external validating signer should not trust these keys.
607+
pub fn trust_key_derivation(&self) -> &TxCreationKeys {
608+
&self.local_keys
609+
}
610+
606611
/// Get the txid of the local commitment transaction contained in this
607612
/// LocalCommitmentTransaction
608613
pub fn txid(&self) -> Txid {

0 commit comments

Comments
 (0)