Skip to content

Commit 8abdb86

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 8f8558c commit 8abdb86

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
@@ -255,7 +255,7 @@ pub trait EcdsaChannelSigner: ChannelSigner {
255255
/// This method is *not* asynchronous. If an `Err` is returned, the channel will be immediately
256256
/// closed.
257257
fn sign_splicing_funding_input(
258-
&self, tx: &Transaction, input_index: usize, input_value: u64,
259-
secp_ctx: &Secp256k1<secp256k1::All>,
258+
&self, channel_parameters: &ChannelTransactionParameters, tx: &Transaction,
259+
input_index: usize, input_value: u64, secp_ctx: &Secp256k1<secp256k1::All>,
260260
) -> Result<Signature, ()>;
261261
}

lightning/src/sign/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1704,12 +1704,12 @@ impl EcdsaChannelSigner for InMemorySigner {
17041704
}
17051705

17061706
fn sign_splicing_funding_input(
1707-
&self, tx: &Transaction, input_index: usize, input_value: u64,
1708-
secp_ctx: &Secp256k1<secp256k1::All>,
1707+
&self, channel_parameters: &ChannelTransactionParameters, tx: &Transaction,
1708+
input_index: usize, input_value: u64, secp_ctx: &Secp256k1<secp256k1::All>,
17091709
) -> Result<Signature, ()> {
17101710
let funding_pubkey = PublicKey::from_secret_key(secp_ctx, &self.funding_key);
17111711
let counterparty_funding_key =
1712-
&self.counterparty_pubkeys().expect(MISSING_PARAMS_ERR).funding_pubkey;
1712+
&channel_parameters.counterparty_pubkeys().expect(MISSING_PARAMS_ERR).funding_pubkey;
17131713
let funding_redeemscript =
17141714
make_funding_redeemscript(&funding_pubkey, counterparty_funding_key);
17151715
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
@@ -481,10 +481,16 @@ impl EcdsaChannelSigner for TestChannelSigner {
481481
}
482482

483483
fn sign_splicing_funding_input(
484-
&self, tx: &Transaction, input_index: usize, input_value: u64,
485-
secp_ctx: &Secp256k1<secp256k1::All>,
484+
&self, channel_parameters: &ChannelTransactionParameters, tx: &Transaction,
485+
input_index: usize, input_value: u64, secp_ctx: &Secp256k1<secp256k1::All>,
486486
) -> Result<Signature, ()> {
487-
self.inner.sign_splicing_funding_input(tx, input_index, input_value, secp_ctx)
487+
self.inner.sign_splicing_funding_input(
488+
channel_parameters,
489+
tx,
490+
input_index,
491+
input_value,
492+
secp_ctx,
493+
)
488494
}
489495
}
490496

0 commit comments

Comments
 (0)