Skip to content

Commit 51fb099

Browse files
committed
Move the 2 get_splice_X() methods from Context to FundedChannel
1 parent 1bb3865 commit 51fb099

File tree

1 file changed

+34
-34
lines changed

1 file changed

+34
-34
lines changed

lightning/src/ln/channel.rs

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4593,38 +4593,6 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
45934593
self.channel_transaction_parameters = channel_transaction_parameters;
45944594
self.get_initial_counterparty_commitment_signature(funding, logger)
45954595
}
4596-
4597-
/// Get the splice message that can be sent during splice initiation.
4598-
#[cfg(splicing)]
4599-
pub fn get_splice_init(&self, our_funding_contribution_satoshis: i64,
4600-
funding_feerate_per_kw: u32, locktime: u32,
4601-
) -> msgs::SpliceInit {
4602-
// TODO(splicing): The exisiting pubkey is reused, but a new one should be generated. See #3542.
4603-
// Note that channel_keys_id is supposed NOT to change
4604-
let funding_pubkey = self.get_holder_pubkeys().funding_pubkey.clone();
4605-
msgs::SpliceInit {
4606-
channel_id: self.channel_id,
4607-
funding_contribution_satoshis: our_funding_contribution_satoshis,
4608-
funding_feerate_per_kw,
4609-
locktime,
4610-
funding_pubkey,
4611-
require_confirmed_inputs: None,
4612-
}
4613-
}
4614-
4615-
/// Get the splice_ack message that can be sent in response to splice initiation.
4616-
#[cfg(splicing)]
4617-
pub fn get_splice_ack(&self, our_funding_contribution_satoshis: i64) -> msgs::SpliceAck {
4618-
// TODO(splicing): The exisiting pubkey is reused, but a new one should be generated. See #3542.
4619-
// Note that channel_keys_id is supposed NOT to change
4620-
let funding_pubkey = self.get_holder_pubkeys().funding_pubkey;
4621-
msgs::SpliceAck {
4622-
channel_id: self.channel_id,
4623-
funding_contribution_satoshis: our_funding_contribution_satoshis,
4624-
funding_pubkey,
4625-
require_confirmed_inputs: None,
4626-
}
4627-
}
46284596
}
46294597

46304598
// Internal utility functions for channels
@@ -8487,10 +8455,28 @@ impl<SP: Deref> FundedChannel<SP> where
84878455
our_funding_contribution: our_funding_contribution_satoshis,
84888456
});
84898457

8490-
let msg = self.context.get_splice_init(our_funding_contribution_satoshis, funding_feerate_per_kw, locktime);
8458+
let msg = self.get_splice_init(our_funding_contribution_satoshis, funding_feerate_per_kw, locktime);
84918459
Ok(msg)
84928460
}
84938461

8462+
/// Get the splice message that can be sent during splice initiation.
8463+
#[cfg(splicing)]
8464+
pub fn get_splice_init(&self, our_funding_contribution_satoshis: i64,
8465+
funding_feerate_per_kw: u32, locktime: u32,
8466+
) -> msgs::SpliceInit {
8467+
// TODO(splicing): The exisiting pubkey is reused, but a new one should be generated. See #3542.
8468+
// Note that channel_keys_id is supposed NOT to change
8469+
let funding_pubkey = self.context.get_holder_pubkeys().funding_pubkey.clone();
8470+
msgs::SpliceInit {
8471+
channel_id: self.context.channel_id,
8472+
funding_contribution_satoshis: our_funding_contribution_satoshis,
8473+
funding_feerate_per_kw,
8474+
locktime,
8475+
funding_pubkey,
8476+
require_confirmed_inputs: None,
8477+
}
8478+
}
8479+
84948480
/// Handle splice_init
84958481
#[cfg(splicing)]
84968482
pub fn splice_init(&mut self, msg: &msgs::SpliceInit) -> Result<msgs::SpliceAck, ChannelError> {
@@ -8534,11 +8520,25 @@ impl<SP: Deref> FundedChannel<SP> where
85348520
// TODO(splicing): Store msg.funding_pubkey
85358521
// TODO(splicing): Apply start of splice (splice_start)
85368522

8537-
let splice_ack_msg = self.context.get_splice_ack(our_funding_contribution_satoshis);
8523+
let splice_ack_msg = self.get_splice_ack(our_funding_contribution_satoshis);
85388524
// TODO(splicing): start interactive funding negotiation
85398525
Ok(splice_ack_msg)
85408526
}
85418527

8528+
/// Get the splice_ack message that can be sent in response to splice initiation.
8529+
#[cfg(splicing)]
8530+
pub fn get_splice_ack(&self, our_funding_contribution_satoshis: i64) -> msgs::SpliceAck {
8531+
// TODO(splicing): The exisiting pubkey is reused, but a new one should be generated. See #3542.
8532+
// Note that channel_keys_id is supposed NOT to change
8533+
let funding_pubkey = self.context.get_holder_pubkeys().funding_pubkey;
8534+
msgs::SpliceAck {
8535+
channel_id: self.context.channel_id,
8536+
funding_contribution_satoshis: our_funding_contribution_satoshis,
8537+
funding_pubkey,
8538+
require_confirmed_inputs: None,
8539+
}
8540+
}
8541+
85428542
/// Handle splice_ack
85438543
#[cfg(splicing)]
85448544
pub fn splice_ack(&mut self, msg: &msgs::SpliceAck) -> Result<(), ChannelError> {

0 commit comments

Comments
 (0)