Skip to content

Commit f08d610

Browse files
authored
Merge pull request #632 from TheBlueMatt/2020-05-drop-chankeys-privs
Drop ChannelKeys Private Key Methods
2 parents 2087032 + e5a7422 commit f08d610

File tree

5 files changed

+46
-72
lines changed

5 files changed

+46
-72
lines changed

lightning/src/chain/keysinterface.rs

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -195,18 +195,6 @@ impl Readable for SpendableOutputDescriptor {
195195
// TODO: We should remove Clone by instead requesting a new ChannelKeys copy when we create
196196
// ChannelMonitors instead of expecting to clone the one out of the Channel into the monitors.
197197
pub trait ChannelKeys : Send+Clone {
198-
/// Gets the private key for the anchor tx
199-
fn funding_key<'a>(&'a self) -> &'a SecretKey;
200-
/// Gets the local secret key for blinded revocation pubkey
201-
fn revocation_base_key<'a>(&'a self) -> &'a SecretKey;
202-
/// Gets the local secret key used in the to_remote output of remote commitment tx (ie the
203-
/// output to us in transactions our counterparty broadcasts).
204-
/// Also as part of obscured commitment number.
205-
fn payment_key<'a>(&'a self) -> &'a SecretKey;
206-
/// Gets the local secret key used in HTLC-Success/HTLC-Timeout txn and to_local output
207-
fn delayed_payment_base_key<'a>(&'a self) -> &'a SecretKey;
208-
/// Gets the local htlc secret key used in commitment tx htlc outputs
209-
fn htlc_base_key<'a>(&'a self) -> &'a SecretKey;
210198
/// Gets the commitment seed
211199
fn commitment_seed<'a>(&'a self) -> &'a [u8; 32];
212200
/// Gets the local channel public keys and basepoints
@@ -345,17 +333,17 @@ pub trait KeysInterface: Send + Sync {
345333
/// A simple implementation of ChannelKeys that just keeps the private keys in memory.
346334
pub struct InMemoryChannelKeys {
347335
/// Private key of anchor tx
348-
funding_key: SecretKey,
336+
pub funding_key: SecretKey,
349337
/// Local secret key for blinded revocation pubkey
350-
revocation_base_key: SecretKey,
338+
pub revocation_base_key: SecretKey,
351339
/// Local secret key used for our balance in remote-broadcasted commitment transactions
352-
payment_key: SecretKey,
340+
pub payment_key: SecretKey,
353341
/// Local secret key used in HTLC tx
354-
delayed_payment_base_key: SecretKey,
342+
pub delayed_payment_base_key: SecretKey,
355343
/// Local htlc secret key used in commitment tx htlc outputs
356-
htlc_base_key: SecretKey,
344+
pub htlc_base_key: SecretKey,
357345
/// Commitment seed
358-
commitment_seed: [u8; 32],
346+
pub commitment_seed: [u8; 32],
359347
/// Local public keys and basepoints
360348
pub(crate) local_channel_pubkeys: ChannelPublicKeys,
361349
/// Remote public keys and base points
@@ -416,11 +404,6 @@ impl InMemoryChannelKeys {
416404
}
417405

418406
impl ChannelKeys for InMemoryChannelKeys {
419-
fn funding_key(&self) -> &SecretKey { &self.funding_key }
420-
fn revocation_base_key(&self) -> &SecretKey { &self.revocation_base_key }
421-
fn payment_key(&self) -> &SecretKey { &self.payment_key }
422-
fn delayed_payment_base_key(&self) -> &SecretKey { &self.delayed_payment_base_key }
423-
fn htlc_base_key(&self) -> &SecretKey { &self.htlc_base_key }
424407
fn commitment_seed(&self) -> &[u8; 32] { &self.commitment_seed }
425408
fn pubkeys<'a>(&'a self) -> &'a ChannelPublicKeys { &self.local_channel_pubkeys }
426409
fn key_derivation_params(&self) -> (u64, u64) { self.key_derivation_params }

lightning/src/ln/channel.rs

Lines changed: 32 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -766,15 +766,14 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
766766

767767
fn get_commitment_transaction_number_obscure_factor(&self) -> u64 {
768768
let mut sha = Sha256::engine();
769-
let our_payment_point = PublicKey::from_secret_key(&self.secp_ctx, self.local_keys.payment_key());
770769

771770
let their_payment_point = &self.their_pubkeys.as_ref().unwrap().payment_point.serialize();
772771
if self.channel_outbound {
773-
sha.input(&our_payment_point.serialize());
772+
sha.input(&self.local_keys.pubkeys().payment_point.serialize());
774773
sha.input(their_payment_point);
775774
} else {
776775
sha.input(their_payment_point);
777-
sha.input(&our_payment_point.serialize());
776+
sha.input(&self.local_keys.pubkeys().payment_point.serialize());
778777
}
779778
let res = Sha256::from_engine(sha).into_inner();
780779

@@ -1095,11 +1094,11 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
10951094
/// TODO Some magic rust shit to compile-time check this?
10961095
fn build_local_transaction_keys(&self, commitment_number: u64) -> Result<TxCreationKeys, ChannelError> {
10971096
let per_commitment_point = PublicKey::from_secret_key(&self.secp_ctx, &self.build_local_commitment_secret(commitment_number));
1098-
let delayed_payment_base = PublicKey::from_secret_key(&self.secp_ctx, self.local_keys.delayed_payment_base_key());
1099-
let htlc_basepoint = PublicKey::from_secret_key(&self.secp_ctx, self.local_keys.htlc_base_key());
1097+
let delayed_payment_base = &self.local_keys.pubkeys().delayed_payment_basepoint;
1098+
let htlc_basepoint = &self.local_keys.pubkeys().htlc_basepoint;
11001099
let their_pubkeys = self.their_pubkeys.as_ref().unwrap();
11011100

1102-
Ok(secp_check!(TxCreationKeys::new(&self.secp_ctx, &per_commitment_point, &delayed_payment_base, &htlc_basepoint, &their_pubkeys.revocation_basepoint, &their_pubkeys.htlc_basepoint), "Local tx keys generation got bogus keys"))
1101+
Ok(secp_check!(TxCreationKeys::new(&self.secp_ctx, &per_commitment_point, delayed_payment_base, htlc_basepoint, &their_pubkeys.revocation_basepoint, &their_pubkeys.htlc_basepoint), "Local tx keys generation got bogus keys"))
11031102
}
11041103

11051104
#[inline]
@@ -1109,19 +1108,18 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
11091108
fn build_remote_transaction_keys(&self) -> Result<TxCreationKeys, ChannelError> {
11101109
//TODO: Ensure that the payment_key derived here ends up in the library users' wallet as we
11111110
//may see payments to it!
1112-
let revocation_basepoint = PublicKey::from_secret_key(&self.secp_ctx, self.local_keys.revocation_base_key());
1113-
let htlc_basepoint = PublicKey::from_secret_key(&self.secp_ctx, self.local_keys.htlc_base_key());
1111+
let revocation_basepoint = &self.local_keys.pubkeys().revocation_basepoint;
1112+
let htlc_basepoint = &self.local_keys.pubkeys().htlc_basepoint;
11141113
let their_pubkeys = self.their_pubkeys.as_ref().unwrap();
11151114

1116-
Ok(secp_check!(TxCreationKeys::new(&self.secp_ctx, &self.their_cur_commitment_point.unwrap(), &their_pubkeys.delayed_payment_basepoint, &their_pubkeys.htlc_basepoint, &revocation_basepoint, &htlc_basepoint), "Remote tx keys generation got bogus keys"))
1115+
Ok(secp_check!(TxCreationKeys::new(&self.secp_ctx, &self.their_cur_commitment_point.unwrap(), &their_pubkeys.delayed_payment_basepoint, &their_pubkeys.htlc_basepoint, revocation_basepoint, htlc_basepoint), "Remote tx keys generation got bogus keys"))
11171116
}
11181117

11191118
/// Gets the redeemscript for the funding transaction output (ie the funding transaction output
11201119
/// pays to get_funding_redeemscript().to_v0_p2wsh()).
11211120
/// Panics if called before accept_channel/new_from_req
11221121
pub fn get_funding_redeemscript(&self) -> Script {
1123-
let our_funding_key = PublicKey::from_secret_key(&self.secp_ctx, self.local_keys.funding_key());
1124-
make_funding_redeemscript(&our_funding_key, self.their_funding_pubkey())
1122+
make_funding_redeemscript(&self.local_keys.pubkeys().funding_pubkey, self.their_funding_pubkey())
11251123
}
11261124

11271125
/// Builds the htlc-success or htlc-timeout transaction which spends a given HTLC output
@@ -1455,7 +1453,7 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
14551453
log_trace!(logger, "Checking funding_created tx signature {} by key {} against tx {} (sighash {}) with redeemscript {}", log_bytes!(sig.serialize_compact()[..]), log_bytes!(self.their_funding_pubkey().serialize()), encode::serialize_hex(&local_initial_commitment_tx), log_bytes!(local_sighash[..]), encode::serialize_hex(&funding_script));
14561454
secp_check!(self.secp_ctx.verify(&local_sighash, &sig, self.their_funding_pubkey()), "Invalid funding_created signature from peer");
14571455

1458-
let localtx = LocalCommitmentTransaction::new_missing_local_sig(local_initial_commitment_tx, sig.clone(), &PublicKey::from_secret_key(&self.secp_ctx, self.local_keys.funding_key()), self.their_funding_pubkey(), local_keys, self.feerate_per_kw, Vec::new());
1456+
let localtx = LocalCommitmentTransaction::new_missing_local_sig(local_initial_commitment_tx, sig.clone(), &self.local_keys.pubkeys().funding_pubkey, self.their_funding_pubkey(), local_keys, self.feerate_per_kw, Vec::new());
14591457

14601458
let remote_keys = self.build_remote_transaction_keys()?;
14611459
let remote_initial_commitment_tx = self.build_commitment_transaction(self.cur_remote_commitment_transaction_number, &remote_keys, false, false, self.feerate_per_kw, logger).0;
@@ -1568,7 +1566,7 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
15681566
let funding_txo_script = funding_redeemscript.to_v0_p2wsh();
15691567
macro_rules! create_monitor {
15701568
() => { {
1571-
let local_commitment_tx = LocalCommitmentTransaction::new_missing_local_sig(local_initial_commitment_tx.clone(), msg.signature.clone(), &PublicKey::from_secret_key(&self.secp_ctx, self.local_keys.funding_key()), their_funding_pubkey, local_keys.clone(), self.feerate_per_kw, Vec::new());
1569+
let local_commitment_tx = LocalCommitmentTransaction::new_missing_local_sig(local_initial_commitment_tx.clone(), msg.signature.clone(), &self.local_keys.pubkeys().funding_pubkey, their_funding_pubkey, local_keys.clone(), self.feerate_per_kw, Vec::new());
15721570
let mut channel_monitor = ChannelMonitor::new(self.local_keys.clone(),
15731571
&self.shutdown_pubkey, self.our_to_self_delay,
15741572
&self.destination_script, (funding_txo.clone(), funding_txo_script.clone()),
@@ -1899,7 +1897,7 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
18991897
let mut monitor_update = ChannelMonitorUpdate {
19001898
update_id: self.latest_monitor_update_id,
19011899
updates: vec![ChannelMonitorUpdateStep::LatestLocalCommitmentTXInfo {
1902-
commitment_tx: LocalCommitmentTransaction::new_missing_local_sig(local_commitment_tx.0, msg.signature.clone(), &PublicKey::from_secret_key(&self.secp_ctx, self.local_keys.funding_key()), &their_funding_pubkey, local_keys, self.feerate_per_kw, htlcs_without_source),
1900+
commitment_tx: LocalCommitmentTransaction::new_missing_local_sig(local_commitment_tx.0, msg.signature.clone(), &self.local_keys.pubkeys().funding_pubkey, &their_funding_pubkey, local_keys, self.feerate_per_kw, htlcs_without_source),
19031901
htlc_outputs: htlcs_and_sigs
19041902
}]
19051903
};
@@ -2825,7 +2823,7 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
28252823

28262824
tx.input[0].witness.push(Vec::new()); // First is the multisig dummy
28272825

2828-
let our_funding_key = PublicKey::from_secret_key(&self.secp_ctx, self.local_keys.funding_key()).serialize();
2826+
let our_funding_key = self.local_keys.pubkeys().funding_pubkey.serialize();
28292827
let their_funding_key = self.their_funding_pubkey().serialize();
28302828
if our_funding_key[..] < their_funding_key[..] {
28312829
tx.input[0].witness.push(our_sig.serialize_der().to_vec());
@@ -3302,6 +3300,7 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
33023300
}
33033301

33043302
let local_commitment_secret = self.build_local_commitment_secret(self.cur_local_commitment_transaction_number);
3303+
let local_keys = self.local_keys.pubkeys();
33053304

33063305
msgs::OpenChannel {
33073306
chain_hash: chain_hash,
@@ -3315,11 +3314,11 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
33153314
feerate_per_kw: fee_estimator.get_est_sat_per_1000_weight(ConfirmationTarget::Background) as u32,
33163315
to_self_delay: self.our_to_self_delay,
33173316
max_accepted_htlcs: OUR_MAX_HTLCS,
3318-
funding_pubkey: PublicKey::from_secret_key(&self.secp_ctx, self.local_keys.funding_key()),
3319-
revocation_basepoint: PublicKey::from_secret_key(&self.secp_ctx, self.local_keys.revocation_base_key()),
3320-
payment_point: PublicKey::from_secret_key(&self.secp_ctx, self.local_keys.payment_key()),
3321-
delayed_payment_basepoint: PublicKey::from_secret_key(&self.secp_ctx, self.local_keys.delayed_payment_base_key()),
3322-
htlc_basepoint: PublicKey::from_secret_key(&self.secp_ctx, self.local_keys.htlc_base_key()),
3317+
funding_pubkey: local_keys.funding_pubkey,
3318+
revocation_basepoint: local_keys.revocation_basepoint,
3319+
payment_point: local_keys.payment_point,
3320+
delayed_payment_basepoint: local_keys.delayed_payment_basepoint,
3321+
htlc_basepoint: local_keys.htlc_basepoint,
33233322
first_per_commitment_point: PublicKey::from_secret_key(&self.secp_ctx, &local_commitment_secret),
33243323
channel_flags: if self.config.announced_channel {1} else {0},
33253324
shutdown_scriptpubkey: OptionalField::Present(if self.config.commit_upfront_shutdown_pubkey { self.get_closing_scriptpubkey() } else { Builder::new().into_script() })
@@ -3338,6 +3337,7 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
33383337
}
33393338

33403339
let local_commitment_secret = self.build_local_commitment_secret(self.cur_local_commitment_transaction_number);
3340+
let local_keys = self.local_keys.pubkeys();
33413341

33423342
msgs::AcceptChannel {
33433343
temporary_channel_id: self.channel_id,
@@ -3348,11 +3348,11 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
33483348
minimum_depth: self.minimum_depth,
33493349
to_self_delay: self.our_to_self_delay,
33503350
max_accepted_htlcs: OUR_MAX_HTLCS,
3351-
funding_pubkey: PublicKey::from_secret_key(&self.secp_ctx, self.local_keys.funding_key()),
3352-
revocation_basepoint: PublicKey::from_secret_key(&self.secp_ctx, self.local_keys.revocation_base_key()),
3353-
payment_point: PublicKey::from_secret_key(&self.secp_ctx, self.local_keys.payment_key()),
3354-
delayed_payment_basepoint: PublicKey::from_secret_key(&self.secp_ctx, self.local_keys.delayed_payment_base_key()),
3355-
htlc_basepoint: PublicKey::from_secret_key(&self.secp_ctx, self.local_keys.htlc_base_key()),
3351+
funding_pubkey: local_keys.funding_pubkey,
3352+
revocation_basepoint: local_keys.revocation_basepoint,
3353+
payment_point: local_keys.payment_point,
3354+
delayed_payment_basepoint: local_keys.delayed_payment_basepoint,
3355+
htlc_basepoint: local_keys.htlc_basepoint,
33563356
first_per_commitment_point: PublicKey::from_secret_key(&self.secp_ctx, &local_commitment_secret),
33573357
shutdown_scriptpubkey: OptionalField::Present(if self.config.commit_upfront_shutdown_pubkey { self.get_closing_scriptpubkey() } else { Builder::new().into_script() })
33583358
}
@@ -3431,16 +3431,15 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
34313431
}
34323432

34333433
let were_node_one = our_node_id.serialize()[..] < self.their_node_id.serialize()[..];
3434-
let our_bitcoin_key = PublicKey::from_secret_key(&self.secp_ctx, self.local_keys.funding_key());
34353434

34363435
let msg = msgs::UnsignedChannelAnnouncement {
34373436
features: ChannelFeatures::known(),
34383437
chain_hash: chain_hash,
34393438
short_channel_id: self.get_short_channel_id().unwrap(),
34403439
node_id_1: if were_node_one { our_node_id } else { self.get_their_node_id() },
34413440
node_id_2: if were_node_one { self.get_their_node_id() } else { our_node_id },
3442-
bitcoin_key_1: if were_node_one { our_bitcoin_key } else { self.their_funding_pubkey().clone() },
3443-
bitcoin_key_2: if were_node_one { self.their_funding_pubkey().clone() } else { our_bitcoin_key },
3441+
bitcoin_key_1: if were_node_one { self.local_keys.pubkeys().funding_pubkey } else { self.their_funding_pubkey().clone() },
3442+
bitcoin_key_2: if were_node_one { self.their_funding_pubkey().clone() } else { self.local_keys.pubkeys().funding_pubkey },
34443443
excess_data: Vec::new(),
34453444
};
34463445

@@ -4442,7 +4441,7 @@ mod tests {
44424441
(0, 0)
44434442
);
44444443

4445-
assert_eq!(PublicKey::from_secret_key(&secp_ctx, chan_keys.funding_key()).serialize()[..],
4444+
assert_eq!(chan_keys.pubkeys().funding_pubkey.serialize()[..],
44464445
hex::decode("023da092f6980e58d2c037173180e9a465476026ee50f96695963e8efe436f54eb").unwrap()[..]);
44474446
let keys_provider = Keys { chan_keys: chan_keys.clone() };
44484447

@@ -4477,11 +4476,11 @@ mod tests {
44774476
// We can't just use build_local_transaction_keys here as the per_commitment_secret is not
44784477
// derived from a commitment_seed, so instead we copy it here and call
44794478
// build_commitment_transaction.
4480-
let delayed_payment_base = PublicKey::from_secret_key(&secp_ctx, chan.local_keys.delayed_payment_base_key());
4479+
let delayed_payment_base = &chan.local_keys.pubkeys().delayed_payment_basepoint;
44814480
let per_commitment_secret = SecretKey::from_slice(&hex::decode("1f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100").unwrap()[..]).unwrap();
44824481
let per_commitment_point = PublicKey::from_secret_key(&secp_ctx, &per_commitment_secret);
4483-
let htlc_basepoint = PublicKey::from_secret_key(&secp_ctx, chan.local_keys.htlc_base_key());
4484-
let keys = TxCreationKeys::new(&secp_ctx, &per_commitment_point, &delayed_payment_base, &htlc_basepoint, &their_pubkeys.revocation_basepoint, &their_pubkeys.htlc_basepoint).unwrap();
4482+
let htlc_basepoint = &chan.local_keys.pubkeys().htlc_basepoint;
4483+
let keys = TxCreationKeys::new(&secp_ctx, &per_commitment_point, delayed_payment_base, htlc_basepoint, &their_pubkeys.revocation_basepoint, &their_pubkeys.htlc_basepoint).unwrap();
44854484

44864485
chan.their_pubkeys = Some(their_pubkeys);
44874486

@@ -4512,7 +4511,7 @@ mod tests {
45124511
})*
45134512
assert_eq!(unsigned_tx.1.len(), per_htlc.len());
45144513

4515-
localtx = LocalCommitmentTransaction::new_missing_local_sig(unsigned_tx.0.clone(), their_signature.clone(), &PublicKey::from_secret_key(&secp_ctx, chan.local_keys.funding_key()), chan.their_funding_pubkey(), keys.clone(), chan.feerate_per_kw, per_htlc);
4514+
localtx = LocalCommitmentTransaction::new_missing_local_sig(unsigned_tx.0.clone(), their_signature.clone(), &chan_keys.pubkeys().funding_pubkey, chan.their_funding_pubkey(), keys.clone(), chan.feerate_per_kw, per_htlc);
45164515
let local_sig = chan_keys.sign_local_commitment(&localtx, &chan.secp_ctx).unwrap();
45174516
assert_eq!(Signature::from_der(&hex::decode($our_sig_hex).unwrap()[..]).unwrap(), local_sig);
45184517

lightning/src/ln/channelmonitor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1641,7 +1641,7 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
16411641
self.remote_payment_script = {
16421642
// Note that the Network here is ignored as we immediately drop the address for the
16431643
// script_pubkey version
1644-
let payment_hash160 = WPubkeyHash::hash(&PublicKey::from_secret_key(&self.secp_ctx, &self.keys.payment_key()).serialize());
1644+
let payment_hash160 = WPubkeyHash::hash(&self.keys.pubkeys().payment_point.serialize());
16451645
Builder::new().push_opcode(opcodes::all::OP_PUSHBYTES_0).push_slice(&payment_hash160[..]).into_script()
16461646
};
16471647

lightning/src/ln/functional_tests.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3850,8 +3850,8 @@ fn test_invalid_channel_announcement() {
38503850
macro_rules! sign_msg {
38513851
($unsigned_msg: expr) => {
38523852
let msghash = Message::from_slice(&Sha256dHash::hash(&$unsigned_msg.encode()[..])[..]).unwrap();
3853-
let as_bitcoin_sig = secp_ctx.sign(&msghash, &as_chan.get_local_keys().inner.funding_key());
3854-
let bs_bitcoin_sig = secp_ctx.sign(&msghash, &bs_chan.get_local_keys().inner.funding_key());
3853+
let as_bitcoin_sig = secp_ctx.sign(&msghash, &as_chan.get_local_keys().inner.funding_key);
3854+
let bs_bitcoin_sig = secp_ctx.sign(&msghash, &bs_chan.get_local_keys().inner.funding_key);
38553855
let as_node_sig = secp_ctx.sign(&msghash, &nodes[0].keys_manager.get_node_secret());
38563856
let bs_node_sig = secp_ctx.sign(&msghash, &nodes[1].keys_manager.get_node_secret());
38573857
chan_announcement = msgs::ChannelAnnouncement {
@@ -4293,10 +4293,10 @@ macro_rules! check_spendable_outputs {
42934293
};
42944294
let secp_ctx = Secp256k1::new();
42954295
let keys = $keysinterface.derive_channel_keys($chan_value, key_derivation_params.0, key_derivation_params.1);
4296-
let remotepubkey = PublicKey::from_secret_key(&secp_ctx, &keys.payment_key());
4296+
let remotepubkey = keys.pubkeys().payment_point;
42974297
let witness_script = Address::p2pkh(&::bitcoin::PublicKey{compressed: true, key: remotepubkey}, Network::Testnet).script_pubkey();
42984298
let sighash = Message::from_slice(&bip143::SighashComponents::new(&spend_tx).sighash_all(&spend_tx.input[0], &witness_script, output.value)[..]).unwrap();
4299-
let remotesig = secp_ctx.sign(&sighash, &keys.payment_key());
4299+
let remotesig = secp_ctx.sign(&sighash, &keys.inner.payment_key);
43004300
spend_tx.input[0].witness.push(remotesig.serialize_der().to_vec());
43014301
spend_tx.input[0].witness[0].push(SigHashType::All as u8);
43024302
spend_tx.input[0].witness.push(remotepubkey.serialize().to_vec());
@@ -4321,7 +4321,7 @@ macro_rules! check_spendable_outputs {
43214321
};
43224322
let secp_ctx = Secp256k1::new();
43234323
let keys = $keysinterface.derive_channel_keys($chan_value, key_derivation_params.0, key_derivation_params.1);
4324-
if let Ok(delayed_payment_key) = chan_utils::derive_private_key(&secp_ctx, &per_commitment_point, keys.delayed_payment_base_key()) {
4324+
if let Ok(delayed_payment_key) = chan_utils::derive_private_key(&secp_ctx, &per_commitment_point, &keys.inner.delayed_payment_base_key) {
43254325

43264326
let delayed_payment_pubkey = PublicKey::from_secret_key(&secp_ctx, &delayed_payment_key);
43274327
let witness_script = chan_utils::get_revokeable_redeemscript(remote_revocation_pubkey, *to_self_delay, &delayed_payment_pubkey);

0 commit comments

Comments
 (0)