mirror of
https://github.com/lightningdevkit/rust-lightning.git
synced 2025-03-14 07:06:42 +01:00
Pass channel params to sign_splicing_funding_input
Now that channel_value_satoshis has been moved to ChannelTransactionParameters, pass the entire parameters when calling each method on EcdsaChannelSigner. This will remove the need for ChannelSigner::provide_channel_parameters. Instead, the parameters from the FundingScope will be passed in to each method. This simplifies the interaction with a ChannelSigner when needing to be called for more than one FundingScope, which will be the case for pending splices and RBF attempts.
This commit is contained in:
parent
dcea1ac876
commit
e74c698e0b
3 changed files with 14 additions and 8 deletions
|
@ -254,7 +254,7 @@ pub trait EcdsaChannelSigner: ChannelSigner {
|
|||
/// This method is *not* asynchronous. If an `Err` is returned, the channel will be immediately
|
||||
/// closed.
|
||||
fn sign_splicing_funding_input(
|
||||
&self, tx: &Transaction, input_index: usize, input_value: u64,
|
||||
secp_ctx: &Secp256k1<secp256k1::All>,
|
||||
&self, channel_parameters: &ChannelTransactionParameters, tx: &Transaction,
|
||||
input_index: usize, input_value: u64, secp_ctx: &Secp256k1<secp256k1::All>,
|
||||
) -> Result<Signature, ()>;
|
||||
}
|
||||
|
|
|
@ -1686,12 +1686,12 @@ impl EcdsaChannelSigner for InMemorySigner {
|
|||
}
|
||||
|
||||
fn sign_splicing_funding_input(
|
||||
&self, tx: &Transaction, input_index: usize, input_value: u64,
|
||||
secp_ctx: &Secp256k1<secp256k1::All>,
|
||||
&self, channel_parameters: &ChannelTransactionParameters, tx: &Transaction,
|
||||
input_index: usize, input_value: u64, secp_ctx: &Secp256k1<secp256k1::All>,
|
||||
) -> Result<Signature, ()> {
|
||||
let funding_pubkey = PublicKey::from_secret_key(secp_ctx, &self.funding_key);
|
||||
let counterparty_funding_key =
|
||||
&self.counterparty_pubkeys().expect(MISSING_PARAMS_ERR).funding_pubkey;
|
||||
&channel_parameters.counterparty_pubkeys().expect(MISSING_PARAMS_ERR).funding_pubkey;
|
||||
let funding_redeemscript =
|
||||
make_funding_redeemscript(&funding_pubkey, counterparty_funding_key);
|
||||
let sighash = &sighash::SighashCache::new(tx)
|
||||
|
|
|
@ -478,10 +478,16 @@ impl EcdsaChannelSigner for TestChannelSigner {
|
|||
}
|
||||
|
||||
fn sign_splicing_funding_input(
|
||||
&self, tx: &Transaction, input_index: usize, input_value: u64,
|
||||
secp_ctx: &Secp256k1<secp256k1::All>,
|
||||
&self, channel_parameters: &ChannelTransactionParameters, tx: &Transaction,
|
||||
input_index: usize, input_value: u64, secp_ctx: &Secp256k1<secp256k1::All>,
|
||||
) -> Result<Signature, ()> {
|
||||
self.inner.sign_splicing_funding_input(tx, input_index, input_value, secp_ctx)
|
||||
self.inner.sign_splicing_funding_input(
|
||||
channel_parameters,
|
||||
tx,
|
||||
input_index,
|
||||
input_value,
|
||||
secp_ctx,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue