Skip to content

Commit c6ec620

Browse files
committed
Add splice wire message structs
1 parent 073f078 commit c6ec620

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

lightning/src/ln/msgs.rs

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,53 @@ pub struct ChannelReady {
429429
pub short_channel_id_alias: Option<u64>,
430430
}
431431

432+
/// A splice message to be sent by or received from the splice initiator.
433+
/// TODO(splicing): Is using 'splice initiator' role OK?
434+
/// TODO(splicing): Can the channel acceptor later be the splice initiator?
435+
///
436+
// TODO(splicing): Add spec link for `splice`; still in draft, using from https://github.com/lightning/bolts/pull/863
437+
#[derive(Clone, Debug, PartialEq, Eq)]
438+
pub struct Splice {
439+
/// The channel ID where splicing is intended
440+
pub channel_id: ChannelId,
441+
/// The genesis hash of the blockchain where the channel is intended to be spliced
442+
pub chain_hash: BlockHash,
443+
/// The intended change in channel capacity: the amount to be added (positive value)
444+
/// or removed (negative value) by the sender (splice initiator) by splicing into/from the channel.
445+
pub relative_satoshis: i64,
446+
/// The feerate for the new funding transaction, set by the splice initiator
447+
pub funding_feerate_perkw: u32,
448+
/// The locktime for the new funding transaction
449+
pub locktime: u32,
450+
/// The key of the sender (splice initiator) controlling the new funding transaction
451+
pub funding_pubkey: PublicKey,
452+
}
453+
454+
/// A splice_ack message to be received by or sent to the splice initiator.
455+
///
456+
// TODO(splicing): Add spec link for `splice_ack`; still in draft, using from https://github.com/lightning/bolts/pull/863
457+
#[derive(Clone, Debug, PartialEq, Eq)]
458+
pub struct SpliceAck {
459+
/// The channel ID where splicing is intended
460+
pub channel_id: ChannelId,
461+
/// The genesis hash of the blockchain where the channel is intended to be spliced
462+
pub chain_hash: BlockHash,
463+
/// The intended change in channel capacity: the amount to be added (positive value)
464+
/// or removed (negative value) by the sender (splice acceptor) by splicing into/from the channel.
465+
pub relative_satoshis: i64,
466+
/// The key of the sender (splice acceptor) controlling the new funding transaction
467+
pub funding_pubkey: PublicKey,
468+
}
469+
470+
/// A splice_locked message to be sent to or received from a peer.
471+
///
472+
// TODO(splicing): Add spec link for `splice_locked`; still in draft, using from https://github.com/lightning/bolts/pull/863
473+
#[derive(Clone, Debug, PartialEq, Eq)]
474+
pub struct SpliceLocked {
475+
/// The channel ID
476+
pub channel_id: ChannelId,
477+
}
478+
432479
/// A tx_add_input message for adding an input during interactive transaction construction
433480
///
434481
// TODO(dual_funding): Add spec link for `tx_add_input`.

0 commit comments

Comments
 (0)