Skip to content

Commit c09c9fb

Browse files
author
Antoine Riard
committed
Rename a's keys as local's keys and b's keys as remote's keys
Variables should be named according to the script semantic which is an invariant with regards to generating a local or remote commitment transaction. I.e a local_delayed_payment key will always offer to the owner of the commitment transaction to be paid back after a given delay.
1 parent 2087032 commit c09c9fb

File tree

6 files changed

+66
-66
lines changed

6 files changed

+66
-66
lines changed

lightning/src/chain/keysinterface.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ impl ChannelKeys for InMemoryChannelKeys {
440440
let mut htlc_sigs = Vec::with_capacity(htlcs.len());
441441
for ref htlc in htlcs {
442442
if let Some(_) = htlc.transaction_output_index {
443-
let htlc_tx = chan_utils::build_htlc_transaction(&commitment_txid, feerate_per_kw, to_self_delay, htlc, &keys.a_delayed_payment_key, &keys.revocation_key);
443+
let htlc_tx = chan_utils::build_htlc_transaction(&commitment_txid, feerate_per_kw, to_self_delay, htlc, &keys.local_delayed_payment_key, &keys.revocation_key);
444444
let htlc_redeemscript = chan_utils::get_htlc_redeemscript(&htlc, &keys);
445445
let htlc_sighash = hash_to_message!(&bip143::SighashComponents::new(&htlc_tx).sighash_all(&htlc_tx.input[0], &htlc_redeemscript, htlc.amount_msat / 1000)[..]);
446446
let our_htlc_key = match chan_utils::derive_private_key(&secp_ctx, &keys.per_commitment_point, &self.htlc_base_key) {

lightning/src/ln/chan_utils.rs

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -227,12 +227,12 @@ pub fn derive_private_revocation_key<T: secp256k1::Signing>(secp_ctx: &Secp256k1
227227
Sha256::from_engine(sha).into_inner()
228228
};
229229

230-
let mut part_a = revocation_base_secret.clone();
231-
part_a.mul_assign(&rev_append_commit_hash_key)?;
232-
let mut part_b = per_commitment_secret.clone();
233-
part_b.mul_assign(&commit_append_rev_hash_key)?;
234-
part_a.add_assign(&part_b[..])?;
235-
Ok(part_a)
230+
let mut remote_contrib = revocation_base_secret.clone();
231+
remote_contrib.mul_assign(&rev_append_commit_hash_key)?;
232+
let mut local_contrib = per_commitment_secret.clone();
233+
local_contrib.mul_assign(&commit_append_rev_hash_key)?;
234+
remote_contrib.add_assign(&local_contrib[..])?;
235+
Ok(remote_contrib)
236236
}
237237

238238
/// Derives a per-commitment-transaction revocation public key from its constituent parts. This is
@@ -257,11 +257,11 @@ pub fn derive_public_revocation_key<T: secp256k1::Verification>(secp_ctx: &Secp2
257257
Sha256::from_engine(sha).into_inner()
258258
};
259259

260-
let mut part_a = revocation_base_point.clone();
261-
part_a.mul_assign(&secp_ctx, &rev_append_commit_hash_key)?;
262-
let mut part_b = per_commitment_point.clone();
263-
part_b.mul_assign(&secp_ctx, &commit_append_rev_hash_key)?;
264-
part_a.combine(&part_b)
260+
let mut remote_contrib = revocation_base_point.clone();
261+
remote_contrib.mul_assign(&secp_ctx, &rev_append_commit_hash_key)?;
262+
let mut local_contrib = per_commitment_point.clone();
263+
local_contrib.mul_assign(&secp_ctx, &commit_append_rev_hash_key)?;
264+
remote_contrib.combine(&local_contrib)
265265
}
266266

267267
/// The set of public keys which are used in the creation of one commitment transaction.
@@ -273,15 +273,15 @@ pub struct TxCreationKeys {
273273
/// The revocation key which is used to allow the owner of the commitment transaction to
274274
/// provide their counterparty the ability to punish them if they broadcast an old state.
275275
pub(crate) revocation_key: PublicKey,
276-
/// A's HTLC Key
277-
pub(crate) a_htlc_key: PublicKey,
278-
/// B's HTLC Key
279-
pub(crate) b_htlc_key: PublicKey,
280-
/// A's Payment Key (which isn't allowed to be spent from for some delay)
281-
pub(crate) a_delayed_payment_key: PublicKey,
276+
/// Local's HTLC Key
277+
pub(crate) local_htlc_key: PublicKey,
278+
/// Remote's HTLC Key
279+
pub(crate) remote_htlc_key: PublicKey,
280+
/// Local's Payment Key (which isn't allowed to be spent from for some delay)
281+
pub(crate) local_delayed_payment_key: PublicKey,
282282
}
283283
impl_writeable!(TxCreationKeys, 33*6,
284-
{ per_commitment_point, revocation_key, a_htlc_key, b_htlc_key, a_delayed_payment_key });
284+
{ per_commitment_point, revocation_key, local_htlc_key, remote_htlc_key, local_delayed_payment_key });
285285

286286
/// One counterparty's public keys which do not change over the life of a channel.
287287
#[derive(Clone, PartialEq)]
@@ -317,13 +317,13 @@ impl_writeable!(ChannelPublicKeys, 33*5, {
317317

318318

319319
impl TxCreationKeys {
320-
pub(crate) fn new<T: secp256k1::Signing + secp256k1::Verification>(secp_ctx: &Secp256k1<T>, per_commitment_point: &PublicKey, a_delayed_payment_base: &PublicKey, a_htlc_base: &PublicKey, b_revocation_base: &PublicKey, b_htlc_base: &PublicKey) -> Result<TxCreationKeys, secp256k1::Error> {
320+
pub(crate) fn new<T: secp256k1::Signing + secp256k1::Verification>(secp_ctx: &Secp256k1<T>, per_commitment_point: &PublicKey, local_delayed_payment_base: &PublicKey, local_htlc_base: &PublicKey, remote_revocation_base: &PublicKey, remote_htlc_base: &PublicKey) -> Result<TxCreationKeys, secp256k1::Error> {
321321
Ok(TxCreationKeys {
322322
per_commitment_point: per_commitment_point.clone(),
323-
revocation_key: derive_public_revocation_key(&secp_ctx, &per_commitment_point, &b_revocation_base)?,
324-
a_htlc_key: derive_public_key(&secp_ctx, &per_commitment_point, &a_htlc_base)?,
325-
b_htlc_key: derive_public_key(&secp_ctx, &per_commitment_point, &b_htlc_base)?,
326-
a_delayed_payment_key: derive_public_key(&secp_ctx, &per_commitment_point, &a_delayed_payment_base)?,
323+
revocation_key: derive_public_revocation_key(&secp_ctx, &per_commitment_point, &remote_revocation_base)?,
324+
local_htlc_key: derive_public_key(&secp_ctx, &per_commitment_point, &local_htlc_base)?,
325+
remote_htlc_key: derive_public_key(&secp_ctx, &per_commitment_point, &remote_htlc_base)?,
326+
local_delayed_payment_key: derive_public_key(&secp_ctx, &per_commitment_point, &local_delayed_payment_base)?,
327327
})
328328
}
329329
}
@@ -374,7 +374,7 @@ impl_writeable!(HTLCOutputInCommitment, 1 + 8 + 4 + 32 + 5, {
374374
});
375375

376376
#[inline]
377-
pub(crate) fn get_htlc_redeemscript_with_explicit_keys(htlc: &HTLCOutputInCommitment, a_htlc_key: &PublicKey, b_htlc_key: &PublicKey, revocation_key: &PublicKey) -> Script {
377+
pub(crate) fn get_htlc_redeemscript_with_explicit_keys(htlc: &HTLCOutputInCommitment, local_htlc_key: &PublicKey, remote_htlc_key: &PublicKey, revocation_key: &PublicKey) -> Script {
378378
let payment_hash160 = Ripemd160::hash(&htlc.payment_hash.0[..]).into_inner();
379379
if htlc.offered {
380380
Builder::new().push_opcode(opcodes::all::OP_DUP)
@@ -384,7 +384,7 @@ pub(crate) fn get_htlc_redeemscript_with_explicit_keys(htlc: &HTLCOutputInCommit
384384
.push_opcode(opcodes::all::OP_IF)
385385
.push_opcode(opcodes::all::OP_CHECKSIG)
386386
.push_opcode(opcodes::all::OP_ELSE)
387-
.push_slice(&b_htlc_key.serialize()[..])
387+
.push_slice(&remote_htlc_key.serialize()[..])
388388
.push_opcode(opcodes::all::OP_SWAP)
389389
.push_opcode(opcodes::all::OP_SIZE)
390390
.push_int(32)
@@ -393,7 +393,7 @@ pub(crate) fn get_htlc_redeemscript_with_explicit_keys(htlc: &HTLCOutputInCommit
393393
.push_opcode(opcodes::all::OP_DROP)
394394
.push_int(2)
395395
.push_opcode(opcodes::all::OP_SWAP)
396-
.push_slice(&a_htlc_key.serialize()[..])
396+
.push_slice(&local_htlc_key.serialize()[..])
397397
.push_int(2)
398398
.push_opcode(opcodes::all::OP_CHECKMULTISIG)
399399
.push_opcode(opcodes::all::OP_ELSE)
@@ -412,7 +412,7 @@ pub(crate) fn get_htlc_redeemscript_with_explicit_keys(htlc: &HTLCOutputInCommit
412412
.push_opcode(opcodes::all::OP_IF)
413413
.push_opcode(opcodes::all::OP_CHECKSIG)
414414
.push_opcode(opcodes::all::OP_ELSE)
415-
.push_slice(&b_htlc_key.serialize()[..])
415+
.push_slice(&remote_htlc_key.serialize()[..])
416416
.push_opcode(opcodes::all::OP_SWAP)
417417
.push_opcode(opcodes::all::OP_SIZE)
418418
.push_int(32)
@@ -423,7 +423,7 @@ pub(crate) fn get_htlc_redeemscript_with_explicit_keys(htlc: &HTLCOutputInCommit
423423
.push_opcode(opcodes::all::OP_EQUALVERIFY)
424424
.push_int(2)
425425
.push_opcode(opcodes::all::OP_SWAP)
426-
.push_slice(&a_htlc_key.serialize()[..])
426+
.push_slice(&local_htlc_key.serialize()[..])
427427
.push_int(2)
428428
.push_opcode(opcodes::all::OP_CHECKMULTISIG)
429429
.push_opcode(opcodes::all::OP_ELSE)
@@ -438,31 +438,31 @@ pub(crate) fn get_htlc_redeemscript_with_explicit_keys(htlc: &HTLCOutputInCommit
438438
}
439439
}
440440

441-
/// note here that 'a_revocation_key' is generated using b_revocation_basepoint and a's
441+
/// note here that 'revocation_key' is generated using remote_revocation_basepoint and local's
442442
/// commitment secret. 'htlc' does *not* need to have its previous_output_index filled.
443443
#[inline]
444444
pub fn get_htlc_redeemscript(htlc: &HTLCOutputInCommitment, keys: &TxCreationKeys) -> Script {
445-
get_htlc_redeemscript_with_explicit_keys(htlc, &keys.a_htlc_key, &keys.b_htlc_key, &keys.revocation_key)
445+
get_htlc_redeemscript_with_explicit_keys(htlc, &keys.local_htlc_key, &keys.remote_htlc_key, &keys.revocation_key)
446446
}
447447

448448
/// Gets the redeemscript for a funding output from the two funding public keys.
449449
/// Note that the order of funding public keys does not matter.
450-
pub fn make_funding_redeemscript(a: &PublicKey, b: &PublicKey) -> Script {
451-
let our_funding_key = a.serialize();
452-
let their_funding_key = b.serialize();
450+
pub fn make_funding_redeemscript(local: &PublicKey, remote: &PublicKey) -> Script {
451+
let local_funding_key = local.serialize();
452+
let remote_funding_key = remote.serialize();
453453

454454
let builder = Builder::new().push_opcode(opcodes::all::OP_PUSHNUM_2);
455-
if our_funding_key[..] < their_funding_key[..] {
456-
builder.push_slice(&our_funding_key)
457-
.push_slice(&their_funding_key)
455+
if local_funding_key[..] < remote_funding_key[..] {
456+
builder.push_slice(&local_funding_key)
457+
.push_slice(&remote_funding_key)
458458
} else {
459-
builder.push_slice(&their_funding_key)
460-
.push_slice(&our_funding_key)
459+
builder.push_slice(&remote_funding_key)
460+
.push_slice(&local_funding_key)
461461
}.push_opcode(opcodes::all::OP_PUSHNUM_2).push_opcode(opcodes::all::OP_CHECKMULTISIG).into_script()
462462
}
463463

464464
/// panics if htlc.transaction_output_index.is_none()!
465-
pub fn build_htlc_transaction(prev_hash: &Txid, feerate_per_kw: u64, to_self_delay: u16, htlc: &HTLCOutputInCommitment, a_delayed_payment_key: &PublicKey, revocation_key: &PublicKey) -> Transaction {
465+
pub fn build_htlc_transaction(prev_hash: &Txid, feerate_per_kw: u64, to_self_delay: u16, htlc: &HTLCOutputInCommitment, local_delayed_payment_key: &PublicKey, revocation_key: &PublicKey) -> Transaction {
466466
let mut txins: Vec<TxIn> = Vec::new();
467467
txins.push(TxIn {
468468
previous_output: OutPoint {
@@ -482,7 +482,7 @@ pub fn build_htlc_transaction(prev_hash: &Txid, feerate_per_kw: u64, to_self_del
482482

483483
let mut txouts: Vec<TxOut> = Vec::new();
484484
txouts.push(TxOut {
485-
script_pubkey: get_revokeable_redeemscript(revocation_key, to_self_delay, a_delayed_payment_key).to_v0_p2wsh(),
485+
script_pubkey: get_revokeable_redeemscript(revocation_key, to_self_delay, local_delayed_payment_key).to_v0_p2wsh(),
486486
value: htlc.amount_msat / 1000 - total_fee //TODO: BOLT 3 does not specify if we should add amount_msat before dividing or if we should divide by 1000 before subtracting (as we do here)
487487
});
488488

@@ -550,9 +550,9 @@ impl LocalCommitmentTransaction {
550550
local_keys: TxCreationKeys {
551551
per_commitment_point: dummy_key.clone(),
552552
revocation_key: dummy_key.clone(),
553-
a_htlc_key: dummy_key.clone(),
554-
b_htlc_key: dummy_key.clone(),
555-
a_delayed_payment_key: dummy_key.clone(),
553+
local_htlc_key: dummy_key.clone(),
554+
remote_htlc_key: dummy_key.clone(),
555+
local_delayed_payment_key: dummy_key.clone(),
556556
},
557557
feerate_per_kw: 0,
558558
per_htlc: Vec::new()
@@ -627,9 +627,9 @@ impl LocalCommitmentTransaction {
627627

628628
for this_htlc in self.per_htlc.iter() {
629629
if this_htlc.0.transaction_output_index.is_some() {
630-
let htlc_tx = build_htlc_transaction(&txid, self.feerate_per_kw, local_csv, &this_htlc.0, &self.local_keys.a_delayed_payment_key, &self.local_keys.revocation_key);
630+
let htlc_tx = build_htlc_transaction(&txid, self.feerate_per_kw, local_csv, &this_htlc.0, &self.local_keys.local_delayed_payment_key, &self.local_keys.revocation_key);
631631

632-
let htlc_redeemscript = get_htlc_redeemscript_with_explicit_keys(&this_htlc.0, &self.local_keys.a_htlc_key, &self.local_keys.b_htlc_key, &self.local_keys.revocation_key);
632+
let htlc_redeemscript = get_htlc_redeemscript_with_explicit_keys(&this_htlc.0, &self.local_keys.local_htlc_key, &self.local_keys.remote_htlc_key, &self.local_keys.revocation_key);
633633

634634
let sighash = hash_to_message!(&bip143::SighashComponents::new(&htlc_tx).sighash_all(&htlc_tx.input[0], &htlc_redeemscript, this_htlc.0.amount_msat / 1000)[..]);
635635
ret.push(Some(secp_ctx.sign(&sighash, &our_htlc_key)));
@@ -650,12 +650,12 @@ impl LocalCommitmentTransaction {
650650
// Further, we should never be provided the preimage for an HTLC-Timeout transaction.
651651
if this_htlc.0.offered && preimage.is_some() { unreachable!(); }
652652

653-
let mut htlc_tx = build_htlc_transaction(&txid, self.feerate_per_kw, local_csv, &this_htlc.0, &self.local_keys.a_delayed_payment_key, &self.local_keys.revocation_key);
653+
let mut htlc_tx = build_htlc_transaction(&txid, self.feerate_per_kw, local_csv, &this_htlc.0, &self.local_keys.local_delayed_payment_key, &self.local_keys.revocation_key);
654654
// Channel should have checked that we have a remote signature for this HTLC at
655655
// creation, and we should have a sensible htlc transaction:
656656
assert!(this_htlc.1.is_some());
657657

658-
let htlc_redeemscript = get_htlc_redeemscript_with_explicit_keys(&this_htlc.0, &self.local_keys.a_htlc_key, &self.local_keys.b_htlc_key, &self.local_keys.revocation_key);
658+
let htlc_redeemscript = get_htlc_redeemscript_with_explicit_keys(&this_htlc.0, &self.local_keys.local_htlc_key, &self.local_keys.remote_htlc_key, &self.local_keys.revocation_key);
659659

660660
// First push the multisig dummy, note that due to BIP147 (NULLDUMMY) it must be a zero-length element.
661661
htlc_tx.input[0].witness.push(Vec::new());

lightning/src/ln/channel.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -964,7 +964,7 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
964964
txouts.push((TxOut {
965965
script_pubkey: chan_utils::get_revokeable_redeemscript(&keys.revocation_key,
966966
if local { self.their_to_self_delay } else { self.our_to_self_delay },
967-
&keys.a_delayed_payment_key).to_v0_p2wsh(),
967+
&keys.local_delayed_payment_key).to_v0_p2wsh(),
968968
value: value_to_a as u64
969969
}, None));
970970
}
@@ -1128,7 +1128,7 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
11281128
/// @local is used only to convert relevant internal structures which refer to remote vs local
11291129
/// to decide value of outputs and direction of HTLCs.
11301130
fn build_htlc_transaction(&self, prev_hash: &Txid, htlc: &HTLCOutputInCommitment, local: bool, keys: &TxCreationKeys, feerate_per_kw: u64) -> Transaction {
1131-
chan_utils::build_htlc_transaction(prev_hash, feerate_per_kw, if local { self.their_to_self_delay } else { self.our_to_self_delay }, htlc, &keys.a_delayed_payment_key, &keys.revocation_key)
1131+
chan_utils::build_htlc_transaction(prev_hash, feerate_per_kw, if local { self.their_to_self_delay } else { self.our_to_self_delay }, htlc, &keys.local_delayed_payment_key, &keys.revocation_key)
11321132
}
11331133

11341134
/// Per HTLC, only one get_update_fail_htlc or get_update_fulfill_htlc call may be made.
@@ -1863,8 +1863,8 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
18631863
let htlc_tx = self.build_htlc_transaction(&local_commitment_txid, &htlc, true, &local_keys, feerate_per_kw);
18641864
let htlc_redeemscript = chan_utils::get_htlc_redeemscript(&htlc, &local_keys);
18651865
let htlc_sighash = hash_to_message!(&bip143::SighashComponents::new(&htlc_tx).sighash_all(&htlc_tx.input[0], &htlc_redeemscript, htlc.amount_msat / 1000)[..]);
1866-
log_trace!(logger, "Checking HTLC tx signature {} by key {} against tx {} (sighash {}) with redeemscript {}", log_bytes!(msg.htlc_signatures[idx].serialize_compact()[..]), log_bytes!(local_keys.b_htlc_key.serialize()), encode::serialize_hex(&htlc_tx), log_bytes!(htlc_sighash[..]), encode::serialize_hex(&htlc_redeemscript));
1867-
if let Err(_) = self.secp_ctx.verify(&htlc_sighash, &msg.htlc_signatures[idx], &local_keys.b_htlc_key) {
1866+
log_trace!(logger, "Checking HTLC tx signature {} by key {} against tx {} (sighash {}) with redeemscript {}", log_bytes!(msg.htlc_signatures[idx].serialize_compact()[..]), log_bytes!(local_keys.remote_htlc_key.serialize()), encode::serialize_hex(&htlc_tx), log_bytes!(htlc_sighash[..]), encode::serialize_hex(&htlc_redeemscript));
1867+
if let Err(_) = self.secp_ctx.verify(&htlc_sighash, &msg.htlc_signatures[idx], &local_keys.remote_htlc_key) {
18681868
return Err((None, ChannelError::Close("Invalid HTLC tx signature from peer")));
18691869
}
18701870
htlcs_without_source.push((htlc.clone(), Some(msg.htlc_signatures[idx])));
@@ -3701,9 +3701,9 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
37013701

37023702
for (ref htlc_sig, ref htlc) in htlc_signatures.iter().zip(htlcs) {
37033703
log_trace!(logger, "Signed remote HTLC tx {} with redeemscript {} with pubkey {} -> {}",
3704-
encode::serialize_hex(&chan_utils::build_htlc_transaction(&remote_commitment_tx.0.txid(), feerate_per_kw, self.our_to_self_delay, htlc, &remote_keys.a_delayed_payment_key, &remote_keys.revocation_key)),
3704+
encode::serialize_hex(&chan_utils::build_htlc_transaction(&remote_commitment_tx.0.txid(), feerate_per_kw, self.our_to_self_delay, htlc, &remote_keys.local_delayed_payment_key, &remote_keys.revocation_key)),
37053705
encode::serialize_hex(&chan_utils::get_htlc_redeemscript(&htlc, &remote_keys)),
3706-
log_bytes!(remote_keys.a_htlc_key.serialize()),
3706+
log_bytes!(remote_keys.local_htlc_key.serialize()),
37073707
log_bytes!(htlc_sig.serialize_compact()[..]));
37083708
}
37093709
}
@@ -4529,7 +4529,7 @@ mod tests {
45294529
let htlc_tx = chan.build_htlc_transaction(&unsigned_tx.0.txid(), &htlc, true, &keys, chan.feerate_per_kw);
45304530
let htlc_redeemscript = chan_utils::get_htlc_redeemscript(&htlc, &keys);
45314531
let htlc_sighash = Message::from_slice(&bip143::SighashComponents::new(&htlc_tx).sighash_all(&htlc_tx.input[0], &htlc_redeemscript, htlc.amount_msat / 1000)[..]).unwrap();
4532-
secp_ctx.verify(&htlc_sighash, &remote_signature, &keys.b_htlc_key).unwrap();
4532+
secp_ctx.verify(&htlc_sighash, &remote_signature, &keys.remote_htlc_key).unwrap();
45334533

45344534
let mut preimage: Option<PaymentPreimage> = None;
45354535
if !htlc.offered {

lightning/src/ln/channelmonitor.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1131,9 +1131,9 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
11311131
let local_commitment_tx = LocalSignedTx {
11321132
txid: initial_local_commitment_tx.txid(),
11331133
revocation_key: initial_local_commitment_tx.local_keys.revocation_key,
1134-
a_htlc_key: initial_local_commitment_tx.local_keys.a_htlc_key,
1135-
b_htlc_key: initial_local_commitment_tx.local_keys.b_htlc_key,
1136-
delayed_payment_key: initial_local_commitment_tx.local_keys.a_delayed_payment_key,
1134+
a_htlc_key: initial_local_commitment_tx.local_keys.local_htlc_key,
1135+
b_htlc_key: initial_local_commitment_tx.local_keys.remote_htlc_key,
1136+
delayed_payment_key: initial_local_commitment_tx.local_keys.local_delayed_payment_key,
11371137
per_commitment_point: initial_local_commitment_tx.local_keys.per_commitment_point,
11381138
feerate_per_kw: initial_local_commitment_tx.feerate_per_kw,
11391139
htlc_outputs: Vec::new(), // There are never any HTLCs in the initial commitment transactions
@@ -1307,9 +1307,9 @@ impl<ChanSigner: ChannelKeys> ChannelMonitor<ChanSigner> {
13071307
let mut new_local_commitment_tx = LocalSignedTx {
13081308
txid,
13091309
revocation_key: commitment_tx.local_keys.revocation_key,
1310-
a_htlc_key: commitment_tx.local_keys.a_htlc_key,
1311-
b_htlc_key: commitment_tx.local_keys.b_htlc_key,
1312-
delayed_payment_key: commitment_tx.local_keys.a_delayed_payment_key,
1310+
a_htlc_key: commitment_tx.local_keys.local_htlc_key,
1311+
b_htlc_key: commitment_tx.local_keys.remote_htlc_key,
1312+
delayed_payment_key: commitment_tx.local_keys.local_delayed_payment_key,
13131313
per_commitment_point: commitment_tx.local_keys.per_commitment_point,
13141314
feerate_per_kw: commitment_tx.feerate_per_kw,
13151315
htlc_outputs: htlc_outputs,

0 commit comments

Comments
 (0)