Skip to content

Commit 8c054df

Browse files
committed
missed a spot
1 parent 181265c commit 8c054df

File tree

3 files changed

+6
-10
lines changed

3 files changed

+6
-10
lines changed

lightning/src/chain/keysinterface.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -274,11 +274,7 @@ pub trait ChannelKeys : Send+Clone {
274274
/// htlc holds HTLC elements (hash, timelock) if the output being spent is a HTLC output, thus
275275
/// changing the format of the witness script (which is committed to in the BIP 143
276276
/// signatures).
277-
///
278-
/// on_remote_tx_csv is the relative lock-time that that our counterparty would have to set on
279-
/// their transaction were they to spend the same output. It is included in the witness script
280-
/// and thus committed to in the BIP 143 signature.
281-
fn sign_justice_transaction<T: secp256k1::Signing + secp256k1::Verification>(&self, justice_tx: &Transaction, input: usize, amount: u64, per_commitment_key: &SecretKey, htlc: &Option<HTLCOutputInCommitment>, on_remote_tx_csv: u16, secp_ctx: &Secp256k1<T>) -> Result<Signature, ()>;
277+
fn sign_justice_transaction<T: secp256k1::Signing + secp256k1::Verification>(&self, justice_tx: &Transaction, input: usize, amount: u64, per_commitment_key: &SecretKey, htlc: &Option<HTLCOutputInCommitment>, secp_ctx: &Secp256k1<T>) -> Result<Signature, ()>;
282278

283279
/// Create a signature for a claiming transaction for a HTLC output on a remote commitment
284280
/// transaction, either offered or received.
@@ -504,7 +500,7 @@ impl ChannelKeys for InMemoryChannelKeys {
504500
local_commitment_tx.get_htlc_sigs(&self.htlc_base_key, local_csv, secp_ctx)
505501
}
506502

507-
fn sign_justice_transaction<T: secp256k1::Signing + secp256k1::Verification>(&self, justice_tx: &Transaction, input: usize, amount: u64, per_commitment_key: &SecretKey, htlc: &Option<HTLCOutputInCommitment>, on_remote_tx_csv: u16, secp_ctx: &Secp256k1<T>) -> Result<Signature, ()> {
503+
fn sign_justice_transaction<T: secp256k1::Signing + secp256k1::Verification>(&self, justice_tx: &Transaction, input: usize, amount: u64, per_commitment_key: &SecretKey, htlc: &Option<HTLCOutputInCommitment>, secp_ctx: &Secp256k1<T>) -> Result<Signature, ()> {
508504
let revocation_key = match chan_utils::derive_private_revocation_key(&secp_ctx, &per_commitment_key, &self.revocation_base_key) {
509505
Ok(revocation_key) => revocation_key,
510506
Err(_) => return Err(())
@@ -529,7 +525,7 @@ impl ChannelKeys for InMemoryChannelKeys {
529525
Ok(remote_delayedpubkey) => remote_delayedpubkey,
530526
Err(_) => return Err(())
531527
};
532-
chan_utils::get_revokeable_redeemscript(&revocation_pubkey, on_remote_tx_csv, &remote_delayedpubkey)
528+
chan_utils::get_revokeable_redeemscript(&revocation_pubkey, self.local_to_self_delay(), &remote_delayedpubkey)
533529
};
534530
let sighash_parts = bip143::SighashComponents::new(&justice_tx);
535531
let sighash = hash_to_message!(&sighash_parts.sighash_all(&justice_tx.input[input], &witness_script, amount)[..]);

lightning/src/ln/onchaintx.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ impl<ChanSigner: ChannelKeys> OnchainTxHandler<ChanSigner> {
582582
chan_utils::get_revokeable_redeemscript(&chan_keys.revocation_key, *on_remote_tx_csv, &chan_keys.a_delayed_payment_key)
583583
};
584584

585-
if let Ok(sig) = self.key_storage.sign_justice_transaction(&bumped_tx, i, *amount, &per_commitment_key, htlc, *on_remote_tx_csv, &self.secp_ctx) {
585+
if let Ok(sig) = self.key_storage.sign_justice_transaction(&bumped_tx, i, *amount, &per_commitment_key, htlc, &self.secp_ctx) {
586586
bumped_tx.input[i].witness.push(sig.serialize_der().to_vec());
587587
bumped_tx.input[i].witness[0].push(SigHashType::All as u8);
588588
if htlc.is_some() {

lightning/src/util/enforcing_trait_impls.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ impl ChannelKeys for EnforcingChannelKeys {
107107
Ok(self.inner.sign_local_commitment_htlc_transactions(local_commitment_tx, secp_ctx).unwrap())
108108
}
109109

110-
fn sign_justice_transaction<T: secp256k1::Signing + secp256k1::Verification>(&self, justice_tx: &Transaction, input: usize, amount: u64, per_commitment_key: &SecretKey, htlc: &Option<HTLCOutputInCommitment>, on_remote_tx_csv: u16, secp_ctx: &Secp256k1<T>) -> Result<Signature, ()> {
111-
Ok(self.inner.sign_justice_transaction(justice_tx, input, amount, per_commitment_key, htlc, on_remote_tx_csv, secp_ctx).unwrap())
110+
fn sign_justice_transaction<T: secp256k1::Signing + secp256k1::Verification>(&self, justice_tx: &Transaction, input: usize, amount: u64, per_commitment_key: &SecretKey, htlc: &Option<HTLCOutputInCommitment>, secp_ctx: &Secp256k1<T>) -> Result<Signature, ()> {
111+
Ok(self.inner.sign_justice_transaction(justice_tx, input, amount, per_commitment_key, htlc, secp_ctx).unwrap())
112112
}
113113

114114
fn sign_remote_htlc_transaction<T: secp256k1::Signing + secp256k1::Verification>(&self, htlc_tx: &Transaction, input: usize, amount: u64, per_commitment_point: &PublicKey, htlc: &HTLCOutputInCommitment, secp_ctx: &Secp256k1<T>) -> Result<Signature, ()> {

0 commit comments

Comments
 (0)