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:
Jeffrey Czyz 2025-02-21 15:52:59 -06:00
parent dcea1ac876
commit e74c698e0b
No known key found for this signature in database
GPG key ID: 3A4E08275D5E96D2
3 changed files with 14 additions and 8 deletions

View file

@ -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, ()>;
}

View file

@ -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)

View file

@ -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,
)
}
}