Skip to content

Commit 87b7bd2

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

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

lightning/src/ln/msgs.rs

+49
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,55 @@ 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 genesis hash of the blockchain where the channel is intended to be spliced
440+
pub chain_hash: BlockHash,
441+
/// The channel ID where splicing is intended
442+
pub channel_id: ChannelId,
443+
/// The amount the sender (splice initiator) is putting into the post-splice channel.
444+
/// It includes their old funded channel amount plus any satoshis they intend to add,
445+
/// or, less any satoshis they intend to remove.
446+
pub funding_satoshis: u64,
447+
/// The feerate for the new funding transaction, set by the splice initiator
448+
pub funding_feerate_perkw: u32,
449+
/// The locktime for the new funding transaction
450+
pub locktime: u32,
451+
/// The key of the sender (splice initiator) controlling the new funding transaction
452+
pub funding_pubkey: PublicKey,
453+
}
454+
455+
/// A splice_ack message to be received by or sent to the splice initiator.
456+
///
457+
// TODO(splicing): Add spec link for `splice_ack`; still in draft, using from https://github.com/lightning/bolts/pull/863
458+
#[derive(Clone, Debug, PartialEq, Eq)]
459+
pub struct SpliceAck {
460+
/// The genesis hash of the blockchain where the channel is intended to be spliced
461+
pub chain_hash: BlockHash,
462+
/// The channel ID where splicing is intended
463+
pub channel_id: ChannelId,
464+
/// The amount the sender (splice acceptor) is putting into the post-splice channel.
465+
/// It includes their old funded channel amount plus any satoshis they intend to add,
466+
/// or, less any satoshis they intend to remove.
467+
pub funding_satoshis: u64,
468+
/// The key of the sender (splice acceptor) controlling the new funding transaction
469+
pub funding_pubkey: PublicKey,
470+
}
471+
472+
/// A splice_locked message to be sent to or received from a peer.
473+
///
474+
// TODO(splicing): Add spec link for `splice_locked`; still in draft, using from https://github.com/lightning/bolts/pull/863
475+
#[derive(Clone, Debug, PartialEq, Eq)]
476+
pub struct SpliceLocked {
477+
/// The channel ID
478+
pub channel_id: ChannelId,
479+
}
480+
432481
/// A tx_add_input message for adding an input during interactive transaction construction
433482
///
434483
// TODO(dual_funding): Add spec link for `tx_add_input`.

0 commit comments

Comments
 (0)