Skip to content

Commit 5d8519b

Browse files
committed
Move the 2 get_splice_X() methods from Context to FundedChannel
1 parent 720a85f commit 5d8519b

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
@@ -4467,38 +4467,6 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
44674467
self.channel_transaction_parameters = channel_transaction_parameters;
44684468
self.get_initial_counterparty_commitment_signature(logger)
44694469
}
4470-
4471-
/// Get the splice message that can be sent during splice initiation.
4472-
#[cfg(splicing)]
4473-
pub fn get_splice_init(&self, our_funding_contribution_satoshis: i64,
4474-
funding_feerate_per_kw: u32, locktime: u32,
4475-
) -> msgs::SpliceInit {
4476-
// TODO(splicing): The exisiting pubkey is reused, but a new one should be generated. See #3542.
4477-
// Note that channel_keys_id is supposed NOT to change
4478-
let funding_pubkey = self.get_holder_pubkeys().funding_pubkey.clone();
4479-
msgs::SpliceInit {
4480-
channel_id: self.channel_id,
4481-
funding_contribution_satoshis: our_funding_contribution_satoshis,
4482-
funding_feerate_per_kw,
4483-
locktime,
4484-
funding_pubkey,
4485-
require_confirmed_inputs: None,
4486-
}
4487-
}
4488-
4489-
/// Get the splice_ack message that can be sent in response to splice initiation.
4490-
#[cfg(splicing)]
4491-
pub fn get_splice_ack(&self, our_funding_contribution_satoshis: i64) -> msgs::SpliceAck {
4492-
// TODO(splicing): The exisiting pubkey is reused, but a new one should be generated. See #3542.
4493-
// Note that channel_keys_id is supposed NOT to change
4494-
let funding_pubkey = self.get_holder_pubkeys().funding_pubkey;
4495-
msgs::SpliceAck {
4496-
channel_id: self.channel_id,
4497-
funding_contribution_satoshis: our_funding_contribution_satoshis,
4498-
funding_pubkey,
4499-
require_confirmed_inputs: None,
4500-
}
4501-
}
45024470
}
45034471

45044472
// Internal utility functions for channels
@@ -8312,10 +8280,28 @@ impl<SP: Deref> FundedChannel<SP> where
83128280
our_funding_contribution: our_funding_contribution_satoshis,
83138281
});
83148282

8315-
let msg = self.context.get_splice_init(our_funding_contribution_satoshis, funding_feerate_per_kw, locktime);
8283+
let msg = self.get_splice_init(our_funding_contribution_satoshis, funding_feerate_per_kw, locktime);
83168284
Ok(msg)
83178285
}
83188286

8287+
/// Get the splice message that can be sent during splice initiation.
8288+
#[cfg(splicing)]
8289+
pub fn get_splice_init(&self, our_funding_contribution_satoshis: i64,
8290+
funding_feerate_per_kw: u32, locktime: u32,
8291+
) -> msgs::SpliceInit {
8292+
// TODO(splicing): The exisiting pubkey is reused, but a new one should be generated. See #3542.
8293+
// Note that channel_keys_id is supposed NOT to change
8294+
let funding_pubkey = self.context.get_holder_pubkeys().funding_pubkey.clone();
8295+
msgs::SpliceInit {
8296+
channel_id: self.context.channel_id,
8297+
funding_contribution_satoshis: our_funding_contribution_satoshis,
8298+
funding_feerate_per_kw,
8299+
locktime,
8300+
funding_pubkey,
8301+
require_confirmed_inputs: None,
8302+
}
8303+
}
8304+
83198305
/// Handle splice_init
83208306
#[cfg(splicing)]
83218307
pub fn splice_init(&mut self, msg: &msgs::SpliceInit) -> Result<msgs::SpliceAck, ChannelError> {
@@ -8359,11 +8345,25 @@ impl<SP: Deref> FundedChannel<SP> where
83598345
// TODO(splicing): Store msg.funding_pubkey
83608346
// TODO(splicing): Apply start of splice (splice_start)
83618347

8362-
let splice_ack_msg = self.context.get_splice_ack(our_funding_contribution_satoshis);
8348+
let splice_ack_msg = self.get_splice_ack(our_funding_contribution_satoshis);
83638349
// TODO(splicing): start interactive funding negotiation
83648350
Ok(splice_ack_msg)
83658351
}
83668352

8353+
/// Get the splice_ack message that can be sent in response to splice initiation.
8354+
#[cfg(splicing)]
8355+
pub fn get_splice_ack(&self, our_funding_contribution_satoshis: i64) -> msgs::SpliceAck {
8356+
// TODO(splicing): The exisiting pubkey is reused, but a new one should be generated. See #3542.
8357+
// Note that channel_keys_id is supposed NOT to change
8358+
let funding_pubkey = self.context.get_holder_pubkeys().funding_pubkey;
8359+
msgs::SpliceAck {
8360+
channel_id: self.context.channel_id,
8361+
funding_contribution_satoshis: our_funding_contribution_satoshis,
8362+
funding_pubkey,
8363+
require_confirmed_inputs: None,
8364+
}
8365+
}
8366+
83678367
/// Handle splice_ack
83688368
#[cfg(splicing)]
83698369
pub fn splice_ack(&mut self, msg: &msgs::SpliceAck) -> Result<(), ChannelError> {

0 commit comments

Comments
 (0)