Skip to content

Refactor ChannelTransactionParameters into FundingScope #3604

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
b0a441f
Reduce ChannelContext::channel_transaction_parameters visibility
jkczyz Feb 13, 2025
d796878
Move channel_transaction_parameters to FundingScope
jkczyz Feb 19, 2025
fa867f3
Move funding_transaction to FundingScope
jkczyz Feb 13, 2025
e23d32d
Remove InMemorySigner (de-)serialization support
jkczyz Feb 26, 2025
21ed477
Include channel_value_satoshis in ChannelTransactionParameters
jkczyz Feb 20, 2025
dc995ea
Remove channel_value_satoshis from FundingScope
jkczyz Feb 20, 2025
ee72c4a
Pass channel params to sign_counterparty_commitment
jkczyz Feb 20, 2025
f638ba4
Pass channel params to sign_holder_commitment
jkczyz Feb 20, 2025
3e9ab72
Pass channel params to sign_justice_revoked_output
jkczyz Feb 20, 2025
a3420d0
Pass channel params to sign_justice_revoked_htlc
jkczyz Feb 20, 2025
18e0d6a
Pass channel params to sign_counterparty_htlc_transaction
jkczyz Feb 20, 2025
8379161
Pass channel params to sign_closing_transaction
jkczyz Feb 21, 2025
dcea1ac
Pass channel params to sign_holder_anchor_input
jkczyz Feb 21, 2025
e74c698
Pass channel params to sign_splicing_funding_input
jkczyz Feb 21, 2025
6caaa54
Use channel parameters in sign_counterparty_payment_input
jkczyz Feb 24, 2025
c8df41d
Use channel parameters in sign_holder_htlc_transaction
jkczyz Feb 24, 2025
88bcf88
Remove ChannelSigner::provide_channel_parameters
jkczyz Feb 24, 2025
9cde57e
Remove channel_value_satoshis from SignerProvider
jkczyz Feb 24, 2025
e0a8eee
Remove custom derive_channel_signer methods
jkczyz Feb 26, 2025
0d127cf
Move get_funding_redeemscript implementation
jkczyz Feb 25, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 3 additions & 19 deletions fuzz/src/chanmon_consistency.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@ use lightning::ln::channelmanager::{
};
use lightning::ln::functional_test_utils::*;
use lightning::ln::inbound_payment::ExpandedKey;
use lightning::ln::msgs::{
ChannelMessageHandler, CommitmentUpdate, DecodeError, Init, UpdateAddHTLC,
};
use lightning::ln::msgs::{ChannelMessageHandler, CommitmentUpdate, Init, UpdateAddHTLC};
use lightning::ln::script::ShutdownScript;
use lightning::ln::types::ChannelId;
use lightning::offers::invoice::UnsignedBolt12Invoice;
Expand Down Expand Up @@ -356,16 +354,12 @@ impl SignerProvider for KeyProvider {
#[cfg(taproot)]
type TaprootSigner = TestChannelSigner;

fn generate_channel_keys_id(
&self, _inbound: bool, _channel_value_satoshis: u64, _user_channel_id: u128,
) -> [u8; 32] {
fn generate_channel_keys_id(&self, _inbound: bool, _user_channel_id: u128) -> [u8; 32] {
let id = self.rand_bytes_id.fetch_add(1, atomic::Ordering::Relaxed) as u8;
[id; 32]
}

fn derive_channel_signer(
&self, channel_value_satoshis: u64, channel_keys_id: [u8; 32],
) -> Self::EcdsaSigner {
fn derive_channel_signer(&self, channel_keys_id: [u8; 32]) -> Self::EcdsaSigner {
let secp_ctx = Secp256k1::signing_only();
let id = channel_keys_id[0];
#[rustfmt::skip]
Expand All @@ -377,23 +371,13 @@ impl SignerProvider for KeyProvider {
SecretKey::from_slice(&[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, self.node_secret[31]]).unwrap(),
SecretKey::from_slice(&[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, self.node_secret[31]]).unwrap(),
[id, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, self.node_secret[31]],
channel_value_satoshis,
channel_keys_id,
channel_keys_id,
);
let revoked_commitment = self.make_enforcement_state_cell(keys.commitment_seed);
TestChannelSigner::new_with_revoked(keys, revoked_commitment, false)
}

fn read_chan_signer(&self, buffer: &[u8]) -> Result<Self::EcdsaSigner, DecodeError> {
let mut reader = lightning::io::Cursor::new(buffer);

let inner: InMemorySigner = ReadableArgs::read(&mut reader, self)?;
let state = self.make_enforcement_state_cell(inner.commitment_seed);

Ok(TestChannelSigner::new_with_revoked(inner, state, false))
}

fn get_destination_script(&self, _channel_keys_id: [u8; 32]) -> Result<ScriptBuf, ()> {
let secp_ctx = Secp256k1::signing_only();
#[rustfmt::skip]
Expand Down
20 changes: 3 additions & 17 deletions fuzz/src/full_stack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ use lightning::ln::channelmanager::{
};
use lightning::ln::functional_test_utils::*;
use lightning::ln::inbound_payment::ExpandedKey;
use lightning::ln::msgs::DecodeError;
use lightning::ln::peer_handler::{
IgnoringMessageHandler, MessageHandler, PeerManager, SocketDescriptor,
};
Expand All @@ -63,7 +62,7 @@ use lightning::util::config::{ChannelConfig, UserConfig};
use lightning::util::errors::APIError;
use lightning::util::hash_tables::*;
use lightning::util::logger::Logger;
use lightning::util::ser::{Readable, ReadableArgs, Writeable};
use lightning::util::ser::{Readable, Writeable};
use lightning::util::test_channel_signer::{EnforcementState, TestChannelSigner};

use lightning_invoice::RawBolt11Invoice;
Expand Down Expand Up @@ -427,19 +426,15 @@ impl SignerProvider for KeyProvider {
#[cfg(taproot)]
type TaprootSigner = TestChannelSigner;

fn generate_channel_keys_id(
&self, inbound: bool, _channel_value_satoshis: u64, _user_channel_id: u128,
) -> [u8; 32] {
fn generate_channel_keys_id(&self, inbound: bool, _user_channel_id: u128) -> [u8; 32] {
let ctr = self.counter.fetch_add(1, Ordering::Relaxed) as u8;
self.signer_state
.borrow_mut()
.insert(ctr, (inbound, Arc::new(Mutex::new(EnforcementState::new()))));
[ctr; 32]
}

fn derive_channel_signer(
&self, channel_value_satoshis: u64, channel_keys_id: [u8; 32],
) -> Self::EcdsaSigner {
fn derive_channel_signer(&self, channel_keys_id: [u8; 32]) -> Self::EcdsaSigner {
let secp_ctx = Secp256k1::signing_only();
let ctr = channel_keys_id[0];
let (inbound, state) = self.signer_state.borrow().get(&ctr).unwrap().clone();
Expand Down Expand Up @@ -476,7 +471,6 @@ impl SignerProvider for KeyProvider {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 6, ctr,
],
channel_value_satoshis,
channel_keys_id,
channel_keys_id,
)
Expand Down Expand Up @@ -512,7 +506,6 @@ impl SignerProvider for KeyProvider {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 12, ctr,
],
channel_value_satoshis,
channel_keys_id,
channel_keys_id,
)
Expand All @@ -522,13 +515,6 @@ impl SignerProvider for KeyProvider {
)
}

fn read_chan_signer(&self, mut data: &[u8]) -> Result<TestChannelSigner, DecodeError> {
let inner: InMemorySigner = ReadableArgs::read(&mut data, self)?;
let state = Arc::new(Mutex::new(EnforcementState::new()));

Ok(TestChannelSigner::new_with_revoked(inner, state, false))
}

fn get_destination_script(&self, _channel_keys_id: [u8; 32]) -> Result<ScriptBuf, ()> {
let secp_ctx = Secp256k1::signing_only();
let channel_monitor_claim_key = SecretKey::from_slice(
Expand Down
14 changes: 3 additions & 11 deletions fuzz/src/onion_message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use lightning::blinded_path::message::{
};
use lightning::blinded_path::EmptyNodeIdLookUp;
use lightning::ln::inbound_payment::ExpandedKey;
use lightning::ln::msgs::{self, DecodeError, OnionMessageHandler};
use lightning::ln::msgs::{self, OnionMessageHandler};
use lightning::ln::peer_handler::IgnoringMessageHandler;
use lightning::ln::script::ShutdownScript;
use lightning::offers::invoice::UnsignedBolt12Invoice;
Expand Down Expand Up @@ -253,19 +253,11 @@ impl SignerProvider for KeyProvider {
#[cfg(taproot)]
type TaprootSigner = TestChannelSigner;

fn generate_channel_keys_id(
&self, _inbound: bool, _channel_value_satoshis: u64, _user_channel_id: u128,
) -> [u8; 32] {
fn generate_channel_keys_id(&self, _inbound: bool, _user_channel_id: u128) -> [u8; 32] {
unreachable!()
}

fn derive_channel_signer(
&self, _channel_value_satoshis: u64, _channel_keys_id: [u8; 32],
) -> Self::EcdsaSigner {
unreachable!()
}

fn read_chan_signer(&self, _data: &[u8]) -> Result<TestChannelSigner, DecodeError> {
fn derive_channel_signer(&self, _channel_keys_id: [u8; 32]) -> Self::EcdsaSigner {
unreachable!()
}

Expand Down
23 changes: 13 additions & 10 deletions lightning/src/chain/channelmonitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3517,8 +3517,11 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
let revokeable_redeemscript = chan_utils::get_revokeable_redeemscript(&revocation_pubkey,
self.counterparty_commitment_params.on_counterparty_tx_csv, &delayed_key);

let channel_parameters = &self.onchain_tx_handler.channel_transaction_parameters;
let sig = self.onchain_tx_handler.signer.sign_justice_revoked_output(
&justice_tx, input_idx, value, &per_commitment_key, &self.onchain_tx_handler.secp_ctx)?;
&channel_parameters, &justice_tx, input_idx, value, &per_commitment_key,
&self.onchain_tx_handler.secp_ctx,
)?;
justice_tx.input[input_idx].witness.push_ecdsa_signature(&BitcoinSignature::sighash_all(sig));
justice_tx.input[input_idx].witness.push(&[1u8]);
justice_tx.input[input_idx].witness.push(revokeable_redeemscript.as_bytes());
Expand Down Expand Up @@ -5398,7 +5401,6 @@ mod tests {
SecretKey::from_slice(&[41; 32]).unwrap(),
SecretKey::from_slice(&[41; 32]).unwrap(),
[41; 32],
0,
[0; 32],
[0; 32],
);
Expand All @@ -5421,7 +5423,8 @@ mod tests {
selected_contest_delay: 67,
}),
funding_outpoint: Some(funding_outpoint),
channel_type_features: ChannelTypeFeatures::only_static_remote_key()
channel_type_features: ChannelTypeFeatures::only_static_remote_key(),
channel_value_satoshis: 0,
};
// Prune with one old state and a holder commitment tx holding a few overlaps with the
// old state.
Expand All @@ -5430,11 +5433,11 @@ mod tests {
let monitor = ChannelMonitor::new(Secp256k1::new(), keys,
Some(ShutdownScript::new_p2wpkh_from_pubkey(shutdown_pubkey).into_inner()), 0, &ScriptBuf::new(),
(OutPoint { txid: Txid::from_slice(&[43; 32]).unwrap(), index: 0 }, ScriptBuf::new()),
&channel_parameters, true, ScriptBuf::new(), 46, 0, HolderCommitmentTransaction::dummy(&mut Vec::new()),
&channel_parameters, true, ScriptBuf::new(), 46, 0, HolderCommitmentTransaction::dummy(0, &mut Vec::new()),
best_block, dummy_key, channel_id);

let mut htlcs = preimages_slice_to_htlcs!(preimages[0..10]);
let dummy_commitment_tx = HolderCommitmentTransaction::dummy(&mut htlcs);
let dummy_commitment_tx = HolderCommitmentTransaction::dummy(0, &mut htlcs);

monitor.provide_latest_holder_commitment_tx(dummy_commitment_tx.clone(),
htlcs.into_iter().map(|(htlc, _)| (htlc, Some(dummy_sig), None)).collect()).unwrap();
Expand Down Expand Up @@ -5473,7 +5476,7 @@ mod tests {
// Now update holder commitment tx info, pruning only element 18 as we still care about the
// previous commitment tx's preimages too
let mut htlcs = preimages_slice_to_htlcs!(preimages[0..5]);
let dummy_commitment_tx = HolderCommitmentTransaction::dummy(&mut htlcs);
let dummy_commitment_tx = HolderCommitmentTransaction::dummy(0, &mut htlcs);
monitor.provide_latest_holder_commitment_tx(dummy_commitment_tx.clone(),
htlcs.into_iter().map(|(htlc, _)| (htlc, Some(dummy_sig), None)).collect()).unwrap();
secret[0..32].clone_from_slice(&<Vec<u8>>::from_hex("2273e227a5b7449b6e70f1fb4652864038b1cbf9cd7c043a7d6456b7fc275ad8").unwrap());
Expand All @@ -5484,7 +5487,7 @@ mod tests {

// But if we do it again, we'll prune 5-10
let mut htlcs = preimages_slice_to_htlcs!(preimages[0..3]);
let dummy_commitment_tx = HolderCommitmentTransaction::dummy(&mut htlcs);
let dummy_commitment_tx = HolderCommitmentTransaction::dummy(0, &mut htlcs);
monitor.provide_latest_holder_commitment_tx(dummy_commitment_tx,
htlcs.into_iter().map(|(htlc, _)| (htlc, Some(dummy_sig), None)).collect()).unwrap();
secret[0..32].clone_from_slice(&<Vec<u8>>::from_hex("27cddaa5624534cb6cb9d7da077cf2b22ab21e9b506fd4998a51d54502e99116").unwrap());
Expand Down Expand Up @@ -5650,7 +5653,6 @@ mod tests {
SecretKey::from_slice(&[41; 32]).unwrap(),
SecretKey::from_slice(&[41; 32]).unwrap(),
[41; 32],
0,
[0; 32],
[0; 32],
);
Expand All @@ -5673,14 +5675,15 @@ mod tests {
selected_contest_delay: 67,
}),
funding_outpoint: Some(funding_outpoint),
channel_type_features: ChannelTypeFeatures::only_static_remote_key()
channel_type_features: ChannelTypeFeatures::only_static_remote_key(),
channel_value_satoshis: 0,
};
let shutdown_pubkey = PublicKey::from_secret_key(&secp_ctx, &SecretKey::from_slice(&[42; 32]).unwrap());
let best_block = BestBlock::from_network(Network::Testnet);
let monitor = ChannelMonitor::new(Secp256k1::new(), keys,
Some(ShutdownScript::new_p2wpkh_from_pubkey(shutdown_pubkey).into_inner()), 0, &ScriptBuf::new(),
(OutPoint { txid: Txid::from_slice(&[43; 32]).unwrap(), index: 0 }, ScriptBuf::new()),
&channel_parameters, true, ScriptBuf::new(), 46, 0, HolderCommitmentTransaction::dummy(&mut Vec::new()),
&channel_parameters, true, ScriptBuf::new(), 46, 0, HolderCommitmentTransaction::dummy(0, &mut Vec::new()),
best_block, dummy_key, channel_id);

let chan_id = monitor.inner.lock().unwrap().channel_id();
Expand Down
15 changes: 7 additions & 8 deletions lightning/src/chain/onchaintx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use bitcoin::secp256k1::{Secp256k1, ecdsa::Signature};
use bitcoin::secp256k1;

use crate::chain::chaininterface::{ConfirmationTarget, compute_feerate_sat_per_1000_weight};
use crate::sign::{ChannelDerivationParameters, HTLCDescriptor, ChannelSigner, EntropySource, SignerProvider, ecdsa::EcdsaChannelSigner};
use crate::sign::{ChannelDerivationParameters, HTLCDescriptor, EntropySource, SignerProvider, ecdsa::EcdsaChannelSigner};
use crate::ln::msgs::DecodeError;
use crate::types::payment::PaymentPreimage;
use crate::ln::chan_utils::{self, ChannelTransactionParameters, HTLCOutputInCommitment, HolderCommitmentTransaction};
Expand Down Expand Up @@ -368,7 +368,7 @@ impl<'a, 'b, ES: EntropySource, SP: SignerProvider> ReadableArgs<(&'a ES, &'b SP
let prev_holder_commitment = Readable::read(reader)?;
let _prev_holder_htlc_sigs: Option<Vec<Option<(usize, Signature)>>> = Readable::read(reader)?;

let channel_parameters = Readable::read(reader)?;
let channel_parameters = ReadableArgs::<u64>::read(reader, channel_value_satoshis)?;

// Read the serialized signer bytes, but don't deserialize them, as we'll obtain our signer
// by re-deriving the private key material.
Expand All @@ -383,8 +383,7 @@ impl<'a, 'b, ES: EntropySource, SP: SignerProvider> ReadableArgs<(&'a ES, &'b SP
bytes_read += bytes_to_read;
}

let mut signer = signer_provider.derive_channel_signer(channel_value_satoshis, channel_keys_id);
signer.provide_channel_parameters(&channel_parameters);
let signer = signer_provider.derive_channel_signer(channel_keys_id);

let pending_claim_requests_len: u64 = Readable::read(reader)?;
let mut pending_claim_requests = hash_map_with_capacity(cmp::min(pending_claim_requests_len as usize, MAX_ALLOC_SIZE / 128));
Expand Down Expand Up @@ -1188,15 +1187,15 @@ impl<ChannelSigner: EcdsaChannelSigner> OnchainTxHandler<ChannelSigner> {
}

pub(crate) fn get_maybe_signed_holder_tx(&mut self, funding_redeemscript: &Script) -> MaybeSignedTransaction {
let tx = self.signer.sign_holder_commitment(&self.holder_commitment, &self.secp_ctx)
let tx = self.signer.sign_holder_commitment(&self.channel_transaction_parameters, &self.holder_commitment, &self.secp_ctx)
.map(|sig| self.holder_commitment.add_holder_sig(funding_redeemscript, sig))
.unwrap_or_else(|_| self.get_unsigned_holder_commitment_tx().clone());
MaybeSignedTransaction(tx)
}

#[cfg(any(test, feature="unsafe_revoked_tx_signing"))]
pub(crate) fn get_fully_signed_copy_holder_tx(&mut self, funding_redeemscript: &Script) -> Transaction {
let sig = self.signer.unsafe_sign_holder_commitment(&self.holder_commitment, &self.secp_ctx).expect("sign holder commitment");
let sig = self.signer.unsafe_sign_holder_commitment(&self.channel_transaction_parameters, &self.holder_commitment, &self.secp_ctx).expect("sign holder commitment");
self.holder_commitment.add_holder_sig(funding_redeemscript, sig)
}

Expand Down Expand Up @@ -1315,7 +1314,6 @@ mod tests {
SecretKey::from_slice(&[41; 32]).unwrap(),
SecretKey::from_slice(&[41; 32]).unwrap(),
[41; 32],
0,
[0; 32],
[0; 32],
);
Expand Down Expand Up @@ -1355,6 +1353,7 @@ mod tests {
}),
funding_outpoint: Some(funding_outpoint),
channel_type_features: ChannelTypeFeatures::only_static_remote_key(),
channel_value_satoshis: 0,
};

// Create an OnchainTxHandler for a commitment containing HTLCs with CLTV expiries of 0, 1,
Expand All @@ -1374,7 +1373,7 @@ mod tests {
(),
));
}
let holder_commit = HolderCommitmentTransaction::dummy(&mut htlcs);
let holder_commit = HolderCommitmentTransaction::dummy(1000000, &mut htlcs);
let mut tx_handler = OnchainTxHandler::new(
1000000,
[0; 32],
Expand Down
9 changes: 5 additions & 4 deletions lightning/src/chain/package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -602,12 +602,13 @@ impl PackageSolvingData {
}
}
fn finalize_input<Signer: EcdsaChannelSigner>(&self, bumped_tx: &mut Transaction, i: usize, onchain_handler: &mut OnchainTxHandler<Signer>) -> bool {
let channel_parameters = &onchain_handler.channel_transaction_parameters;
match self {
PackageSolvingData::RevokedOutput(ref outp) => {
let chan_keys = TxCreationKeys::derive_new(&onchain_handler.secp_ctx, &outp.per_commitment_point, &outp.counterparty_delayed_payment_base_key, &outp.counterparty_htlc_base_key, &onchain_handler.signer.pubkeys().revocation_basepoint, &onchain_handler.signer.pubkeys().htlc_basepoint);
let witness_script = chan_utils::get_revokeable_redeemscript(&chan_keys.revocation_key, outp.on_counterparty_tx_csv, &chan_keys.broadcaster_delayed_payment_key);
//TODO: should we panic on signer failure ?
if let Ok(sig) = onchain_handler.signer.sign_justice_revoked_output(&bumped_tx, i, outp.amount.to_sat(), &outp.per_commitment_key, &onchain_handler.secp_ctx) {
if let Ok(sig) = onchain_handler.signer.sign_justice_revoked_output(channel_parameters, &bumped_tx, i, outp.amount.to_sat(), &outp.per_commitment_key, &onchain_handler.secp_ctx) {
let mut ser_sig = sig.serialize_der().to_vec();
ser_sig.push(EcdsaSighashType::All as u8);
bumped_tx.input[i].witness.push(ser_sig);
Expand All @@ -619,7 +620,7 @@ impl PackageSolvingData {
let chan_keys = TxCreationKeys::derive_new(&onchain_handler.secp_ctx, &outp.per_commitment_point, &outp.counterparty_delayed_payment_base_key, &outp.counterparty_htlc_base_key, &onchain_handler.signer.pubkeys().revocation_basepoint, &onchain_handler.signer.pubkeys().htlc_basepoint);
let witness_script = chan_utils::get_htlc_redeemscript_with_explicit_keys(&outp.htlc, &onchain_handler.channel_type_features(), &chan_keys.broadcaster_htlc_key, &chan_keys.countersignatory_htlc_key, &chan_keys.revocation_key);
//TODO: should we panic on signer failure ?
if let Ok(sig) = onchain_handler.signer.sign_justice_revoked_htlc(&bumped_tx, i, outp.amount, &outp.per_commitment_key, &outp.htlc, &onchain_handler.secp_ctx) {
if let Ok(sig) = onchain_handler.signer.sign_justice_revoked_htlc(channel_parameters, &bumped_tx, i, outp.amount, &outp.per_commitment_key, &outp.htlc, &onchain_handler.secp_ctx) {
let mut ser_sig = sig.serialize_der().to_vec();
ser_sig.push(EcdsaSighashType::All as u8);
bumped_tx.input[i].witness.push(ser_sig);
Expand All @@ -631,7 +632,7 @@ impl PackageSolvingData {
let chan_keys = TxCreationKeys::derive_new(&onchain_handler.secp_ctx, &outp.per_commitment_point, &outp.counterparty_delayed_payment_base_key, &outp.counterparty_htlc_base_key, &onchain_handler.signer.pubkeys().revocation_basepoint, &onchain_handler.signer.pubkeys().htlc_basepoint);
let witness_script = chan_utils::get_htlc_redeemscript_with_explicit_keys(&outp.htlc, &onchain_handler.channel_type_features(), &chan_keys.broadcaster_htlc_key, &chan_keys.countersignatory_htlc_key, &chan_keys.revocation_key);

if let Ok(sig) = onchain_handler.signer.sign_counterparty_htlc_transaction(&bumped_tx, i, &outp.htlc.amount_msat / 1000, &outp.per_commitment_point, &outp.htlc, &onchain_handler.secp_ctx) {
if let Ok(sig) = onchain_handler.signer.sign_counterparty_htlc_transaction(channel_parameters, &bumped_tx, i, &outp.htlc.amount_msat / 1000, &outp.per_commitment_point, &outp.htlc, &onchain_handler.secp_ctx) {
let mut ser_sig = sig.serialize_der().to_vec();
ser_sig.push(EcdsaSighashType::All as u8);
bumped_tx.input[i].witness.push(ser_sig);
Expand All @@ -643,7 +644,7 @@ impl PackageSolvingData {
let chan_keys = TxCreationKeys::derive_new(&onchain_handler.secp_ctx, &outp.per_commitment_point, &outp.counterparty_delayed_payment_base_key, &outp.counterparty_htlc_base_key, &onchain_handler.signer.pubkeys().revocation_basepoint, &onchain_handler.signer.pubkeys().htlc_basepoint);
let witness_script = chan_utils::get_htlc_redeemscript_with_explicit_keys(&outp.htlc, &onchain_handler.channel_type_features(), &chan_keys.broadcaster_htlc_key, &chan_keys.countersignatory_htlc_key, &chan_keys.revocation_key);

if let Ok(sig) = onchain_handler.signer.sign_counterparty_htlc_transaction(&bumped_tx, i, &outp.htlc.amount_msat / 1000, &outp.per_commitment_point, &outp.htlc, &onchain_handler.secp_ctx) {
if let Ok(sig) = onchain_handler.signer.sign_counterparty_htlc_transaction(channel_parameters, &bumped_tx, i, &outp.htlc.amount_msat / 1000, &outp.per_commitment_point, &outp.htlc, &onchain_handler.secp_ctx) {
let mut ser_sig = sig.serialize_der().to_vec();
ser_sig.push(EcdsaSighashType::All as u8);
bumped_tx.input[i].witness.push(ser_sig);
Expand Down
Loading
Loading