Skip to content

Commit 7cece20

Browse files
committed
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.
1 parent e5dfc2c commit 7cece20

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

lightning/src/sign/ecdsa.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ pub trait EcdsaChannelSigner: ChannelSigner {
254254
/// This method is *not* asynchronous. If an `Err` is returned, the channel will be immediately
255255
/// closed.
256256
fn sign_splicing_funding_input(
257-
&self, tx: &Transaction, input_index: usize, input_value: u64,
258-
secp_ctx: &Secp256k1<secp256k1::All>,
257+
&self, channel_parameters: &ChannelTransactionParameters, tx: &Transaction,
258+
input_index: usize, input_value: u64, secp_ctx: &Secp256k1<secp256k1::All>,
259259
) -> Result<Signature, ()>;
260260
}

lightning/src/sign/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1686,12 +1686,12 @@ impl EcdsaChannelSigner for InMemorySigner {
16861686
}
16871687

16881688
fn sign_splicing_funding_input(
1689-
&self, tx: &Transaction, input_index: usize, input_value: u64,
1690-
secp_ctx: &Secp256k1<secp256k1::All>,
1689+
&self, channel_parameters: &ChannelTransactionParameters, tx: &Transaction,
1690+
input_index: usize, input_value: u64, secp_ctx: &Secp256k1<secp256k1::All>,
16911691
) -> Result<Signature, ()> {
16921692
let funding_pubkey = PublicKey::from_secret_key(secp_ctx, &self.funding_key);
16931693
let counterparty_funding_key =
1694-
&self.counterparty_pubkeys().expect(MISSING_PARAMS_ERR).funding_pubkey;
1694+
&channel_parameters.counterparty_pubkeys().expect(MISSING_PARAMS_ERR).funding_pubkey;
16951695
let funding_redeemscript =
16961696
make_funding_redeemscript(&funding_pubkey, counterparty_funding_key);
16971697
let sighash = &sighash::SighashCache::new(tx)

lightning/src/util/test_channel_signer.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -478,10 +478,16 @@ impl EcdsaChannelSigner for TestChannelSigner {
478478
}
479479

480480
fn sign_splicing_funding_input(
481-
&self, tx: &Transaction, input_index: usize, input_value: u64,
482-
secp_ctx: &Secp256k1<secp256k1::All>,
481+
&self, channel_parameters: &ChannelTransactionParameters, tx: &Transaction,
482+
input_index: usize, input_value: u64, secp_ctx: &Secp256k1<secp256k1::All>,
483483
) -> Result<Signature, ()> {
484-
self.inner.sign_splicing_funding_input(tx, input_index, input_value, secp_ctx)
484+
self.inner.sign_splicing_funding_input(
485+
channel_parameters,
486+
tx,
487+
input_index,
488+
input_value,
489+
secp_ctx,
490+
)
485491
}
486492
}
487493

0 commit comments

Comments
 (0)