Skip to content

Commit 5c3575f

Browse files
jkczyzclaude
andcommitted
Rename SplicePending and SpliceFailed events
Rename Event::SplicePending to Event::SpliceNegotiated and Event::SpliceFailed to Event::SpliceNegotiationFailed. These names better reflect the per-round semantics: each negotiation attempt resolves to one of these two outcomes, independent of the overall splice lifecycle. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 40d1b26 commit 5c3575f

10 files changed

Lines changed: 81 additions & 80 deletions

File tree

fuzz/src/chanmon_consistency.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2015,7 +2015,7 @@ pub fn do_test<Out: Output + MaybeSend + MaybeSync>(data: &[u8], out: Out) {
20152015
)
20162016
.unwrap();
20172017
},
2018-
events::Event::SplicePending { new_funding_txo, .. } => {
2018+
events::Event::SpliceNegotiated { new_funding_txo, .. } => {
20192019
let broadcaster = match $node {
20202020
0 => &broadcast_a,
20212021
1 => &broadcast_b,
@@ -2027,7 +2027,7 @@ pub fn do_test<Out: Output + MaybeSend + MaybeSync>(data: &[u8], out: Out) {
20272027
assert_eq!(new_funding_txo.txid, splice_tx.compute_txid());
20282028
chain_state.confirm_tx(splice_tx);
20292029
},
2030-
events::Event::SpliceFailed { .. } => {},
2030+
events::Event::SpliceNegotiationFailed { .. } => {},
20312031
events::Event::DiscardFunding {
20322032
funding_info: events::FundingInfo::Contribution { .. },
20332033
..

fuzz/src/full_stack.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,10 +1141,10 @@ pub fn do_test(mut data: &[u8], logger: &Arc<dyn Logger + MaybeSend + MaybeSync>
11411141
signed_tx,
11421142
);
11431143
},
1144-
Event::SplicePending { .. } => {
1144+
Event::SpliceNegotiated { .. } => {
11451145
// Splice negotiation completed, waiting for confirmation
11461146
},
1147-
Event::SpliceFailed { .. } => {
1147+
Event::SpliceNegotiationFailed { .. } => {
11481148
// Splice failed, inputs can be re-spent
11491149
},
11501150
Event::OpenChannelRequest {

lightning/src/events/mod.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1645,8 +1645,8 @@ pub enum Event {
16451645
/// # Failure Behavior and Persistence
16461646
/// This event will eventually be replayed after failures-to-handle (i.e., the event handler
16471647
/// returning `Err(ReplayEvent ())`) and will be persisted across restarts.
1648-
SplicePending {
1649-
/// The `channel_id` of the channel that has a pending splice funding transaction.
1648+
SpliceNegotiated {
1649+
/// The `channel_id` of the channel with the negotiated splice funding transaction.
16501650
channel_id: ChannelId,
16511651
/// The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
16521652
/// channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels.
@@ -1666,7 +1666,7 @@ pub enum Event {
16661666
},
16671667
/// Used to indicate that a splice negotiation round for the given `channel_id` has failed.
16681668
///
1669-
/// Each splice attempt (initial or RBF) resolves to either [`Event::SplicePending`] on
1669+
/// Each splice attempt (initial or RBF) resolves to either [`Event::SpliceNegotiated`] on
16701670
/// success or this event on failure. Prior successfully negotiated splice transactions are
16711671
/// unaffected.
16721672
///
@@ -1676,7 +1676,7 @@ pub enum Event {
16761676
/// # Failure Behavior and Persistence
16771677
/// This event will eventually be replayed after failures-to-handle (i.e., the event handler
16781678
/// returning `Err(ReplayEvent ())`) and will be persisted across restarts.
1679-
SpliceFailed {
1679+
SpliceNegotiationFailed {
16801680
/// The `channel_id` of the channel for which the splice negotiation round failed.
16811681
channel_id: ChannelId,
16821682
/// The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
@@ -2467,7 +2467,7 @@ impl Writeable for Event {
24672467
// We never write out FundingTransactionReadyForSigning events as they will be regenerated when
24682468
// necessary.
24692469
},
2470-
&Event::SplicePending {
2470+
&Event::SpliceNegotiated {
24712471
ref channel_id,
24722472
ref user_channel_id,
24732473
ref counterparty_node_id,
@@ -2485,7 +2485,7 @@ impl Writeable for Event {
24852485
(11, new_funding_redeem_script, required),
24862486
});
24872487
},
2488-
&Event::SpliceFailed {
2488+
&Event::SpliceNegotiationFailed {
24892489
ref channel_id,
24902490
ref user_channel_id,
24912491
ref counterparty_node_id,
@@ -3124,7 +3124,7 @@ impl MaybeReadable for Event {
31243124
(11, new_funding_redeem_script, required),
31253125
});
31263126

3127-
Ok(Some(Event::SplicePending {
3127+
Ok(Some(Event::SpliceNegotiated {
31283128
channel_id: channel_id.0.unwrap(),
31293129
user_channel_id: user_channel_id.0.unwrap(),
31303130
counterparty_node_id: counterparty_node_id.0.unwrap(),
@@ -3145,7 +3145,7 @@ impl MaybeReadable for Event {
31453145
(13, contribution, option),
31463146
});
31473147

3148-
Ok(Some(Event::SpliceFailed {
3148+
Ok(Some(Event::SpliceNegotiationFailed {
31493149
channel_id: channel_id.0.unwrap(),
31503150
user_channel_id: user_channel_id.0.unwrap(),
31513151
counterparty_node_id: counterparty_node_id.0.unwrap(),

lightning/src/ln/async_signer_tests.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1647,8 +1647,8 @@ fn test_async_splice_initial_commit_sig() {
16471647
get_event_msg!(initiator, MessageSendEvent::SendTxSignatures, acceptor_node_id);
16481648
acceptor.node.handle_tx_signatures(initiator_node_id, &tx_signatures);
16491649

1650-
let _ = get_event!(initiator, Event::SplicePending);
1651-
let _ = get_event!(acceptor, Event::SplicePending);
1650+
let _ = get_event!(initiator, Event::SpliceNegotiated);
1651+
let _ = get_event!(acceptor, Event::SpliceNegotiated);
16521652
}
16531653

16541654
#[test]
@@ -1739,6 +1739,6 @@ fn test_async_splice_initial_commit_sig_waits_for_monitor_before_tx_signatures()
17391739
get_event_msg!(initiator, MessageSendEvent::SendTxSignatures, acceptor_node_id);
17401740
acceptor.node.handle_tx_signatures(initiator_node_id, &tx_signatures);
17411741

1742-
let _ = get_event!(initiator, Event::SplicePending);
1743-
let _ = get_event!(acceptor, Event::SplicePending);
1742+
let _ = get_event!(initiator, Event::SpliceNegotiated);
1743+
let _ = get_event!(acceptor, Event::SpliceNegotiated);
17441744
}

lightning/src/ln/channel.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1170,7 +1170,7 @@ pub(super) struct InteractiveTxMsgError {
11701170
/// The underlying error.
11711171
pub(super) err: ChannelError,
11721172
/// If a splice was in progress when processing the message, this contains the splice funding
1173-
/// information for emitting a `SpliceFailed` event.
1173+
/// information for emitting a `SpliceNegotiationFailed` event.
11741174
pub(super) splice_funding_failed: Option<SpliceFundingFailed>,
11751175
/// Whether we were quiescent when we received the message, and are no longer due to aborting
11761176
/// the session.
@@ -1258,15 +1258,15 @@ pub(crate) struct ShutdownResult {
12581258
pub(crate) channel_funding_txo: Option<OutPoint>,
12591259
pub(crate) last_local_balance_msat: u64,
12601260
/// If a splice was in progress when the channel was shut down, this contains
1261-
/// the splice funding information for emitting a SpliceFailed event.
1261+
/// the splice funding information for emitting a SpliceNegotiationFailed event.
12621262
pub(crate) splice_funding_failed: Option<SpliceFundingFailed>,
12631263
}
12641264

12651265
/// The result of a peer disconnection.
12661266
pub(crate) struct DisconnectResult {
12671267
pub(crate) is_resumable: bool,
12681268
/// If a splice was in progress when the channel was shut down, this contains
1269-
/// the splice funding information for emitting a SpliceFailed event.
1269+
/// the splice funding information for emitting a SpliceNegotiationFailed event.
12701270
pub(crate) splice_funding_failed: Option<SpliceFundingFailed>,
12711271
}
12721272

@@ -7041,7 +7041,7 @@ pub struct SpliceFundingFailed {
70417041

70427042
impl SpliceFundingFailed {
70437043
/// Splits into the funding info for `DiscardFunding` (if there are inputs or outputs to
7044-
/// discard) and the contribution for `SpliceFailed`.
7044+
/// discard) and the contribution for `SpliceNegotiationFailed`.
70457045
pub(super) fn into_parts(self) -> (Option<FundingInfo>, Option<FundingContribution>) {
70467046
let funding_info =
70477047
if !self.contributed_inputs.is_empty() || !self.contributed_outputs.is_empty() {
@@ -12323,7 +12323,7 @@ where
1232312323
//
1232412324
// If the in-progress negotiation later fails (e.g., tx_abort), the derived
1232512325
// min_rbf_feerate becomes stale, causing a slightly higher feerate than
12326-
// necessary. Call splice_channel again after receiving SpliceFailed to get a
12326+
// necessary. Call splice_channel again after receiving SpliceNegotiationFailed to get a
1232712327
// fresh template without the stale RBF constraint.
1232812328
let prev_feerate =
1232912329
pending_splice.last_funding_feerate_sat_per_1000_weight.or_else(|| {

lightning/src/ln/channelmanager.rs

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4119,7 +4119,7 @@ impl<
41194119
));
41204120
}
41214121
pending_events.push_back((
4122-
events::Event::SpliceFailed {
4122+
events::Event::SpliceNegotiationFailed {
41234123
channel_id: *chan_id,
41244124
counterparty_node_id: *counterparty_node_id,
41254125
user_channel_id: chan.context().get_user_id(),
@@ -4425,7 +4425,7 @@ impl<
44254425
));
44264426
}
44274427
pending_events.push_back((
4428-
events::Event::SpliceFailed {
4428+
events::Event::SpliceNegotiationFailed {
44294429
channel_id: shutdown_res.channel_id,
44304430
counterparty_node_id: shutdown_res.counterparty_node_id,
44314431
user_channel_id: shutdown_res.user_channel_id,
@@ -4931,7 +4931,7 @@ impl<
49314931
));
49324932
}
49334933
pending_events.push_back((
4934-
events::Event::SpliceFailed {
4934+
events::Event::SpliceNegotiationFailed {
49354935
channel_id: *channel_id,
49364936
counterparty_node_id: *counterparty_node_id,
49374937
user_channel_id: chan.context.get_user_id(),
@@ -6619,7 +6619,7 @@ impl<
66196619
));
66206620
}
66216621
pending_events.push_back((
6622-
events::Event::SpliceFailed {
6622+
events::Event::SpliceNegotiationFailed {
66236623
channel_id,
66246624
counterparty_node_id,
66256625
user_channel_id,
@@ -6665,14 +6665,14 @@ impl<
66656665
/// # Events
66666666
///
66676667
/// Calling this method will commence the process of creating a new funding transaction for the
6668-
/// channel. Once the funding transaction has been constructed, an [`Event::SplicePending`]
6668+
/// channel. Once the funding transaction has been constructed, an [`Event::SpliceNegotiated`]
66696669
/// will be emitted. At this point, any inputs contributed to the splice can only be re-spent
66706670
/// if an [`Event::DiscardFunding`] is seen.
66716671
///
6672-
/// If any failures occur while negotiating the funding transaction, an [`Event::SpliceFailed`]
6673-
/// will be emitted. Any contributed inputs no longer used will be included in an
6674-
/// [`Event::DiscardFunding`] and thus can be re-spent. If a [`FundingTemplate`] was obtained
6675-
/// while a previous splice was still being negotiated, its
6672+
/// If any failures occur while negotiating the funding transaction, an
6673+
/// [`Event::SpliceNegotiationFailed`] will be emitted. Any contributed inputs no longer used
6674+
/// will be included in an [`Event::DiscardFunding`] and thus can be re-spent. If a
6675+
/// [`FundingTemplate`] was obtained while a previous splice was still being negotiated, its
66766676
/// [`min_rbf_feerate`][FundingTemplate::min_rbf_feerate] may be stale after the failure.
66776677
/// Call [`ChannelManager::splice_channel`] again to get a fresh template.
66786678
///
@@ -6891,7 +6891,7 @@ impl<
68916891
}
68926892
if let Some(splice_negotiated) = splice_negotiated {
68936893
self.pending_events.lock().unwrap().push_back((
6894-
events::Event::SplicePending {
6894+
events::Event::SpliceNegotiated {
68956895
channel_id: *channel_id,
68966896
counterparty_node_id: *counterparty_node_id,
68976897
user_channel_id: chan.context().get_user_id(),
@@ -10984,7 +10984,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
1098410984
.and_then(|v| v.splice_negotiated.take())
1098510985
{
1098610986
pending_events.push_back((
10987-
events::Event::SplicePending {
10987+
events::Event::SpliceNegotiated {
1098810988
channel_id: channel.context.channel_id(),
1098910989
counterparty_node_id,
1099010990
user_channel_id: channel.context.get_user_id(),
@@ -11849,7 +11849,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
1184911849
));
1185011850
}
1185111851
pending_events.push_back((
11852-
events::Event::SpliceFailed {
11852+
events::Event::SpliceNegotiationFailed {
1185311853
channel_id,
1185411854
counterparty_node_id: *counterparty_node_id,
1185511855
user_channel_id: channel.context().get_user_id(),
@@ -12010,7 +12010,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
1201012010
));
1201112011
}
1201212012
pending_events.push_back((
12013-
events::Event::SpliceFailed {
12013+
events::Event::SpliceNegotiationFailed {
1201412014
channel_id: msg.channel_id,
1201512015
counterparty_node_id,
1201612016
user_channel_id: chan.context().get_user_id(),
@@ -12099,7 +12099,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
1209912099
let exited_quiescence = splice_negotiated.is_some();
1210012100
if let Some(splice_negotiated) = splice_negotiated {
1210112101
self.pending_events.lock().unwrap().push_back((
12102-
events::Event::SplicePending {
12102+
events::Event::SpliceNegotiated {
1210312103
channel_id: msg.channel_id,
1210412104
counterparty_node_id: *counterparty_node_id,
1210512105
user_channel_id: chan.context.get_user_id(),
@@ -12182,7 +12182,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
1218212182
));
1218312183
}
1218412184
pending_events.push_back((
12185-
events::Event::SpliceFailed {
12185+
events::Event::SpliceNegotiationFailed {
1218612186
channel_id: msg.channel_id,
1218712187
counterparty_node_id: *counterparty_node_id,
1218812188
user_channel_id: chan_entry.get().context().get_user_id(),
@@ -12334,7 +12334,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
1233412334
));
1233512335
}
1233612336
pending_events.push_back((
12337-
events::Event::SpliceFailed {
12337+
events::Event::SpliceNegotiationFailed {
1233812338
channel_id: msg.channel_id,
1233912339
counterparty_node_id: *counterparty_node_id,
1234012340
user_channel_id: chan.context().get_user_id(),
@@ -15167,16 +15167,16 @@ impl<
1516715167
self.process_pending_events(&event_handler);
1516815168
let collected_events = events.into_inner();
1516915169

15170-
// When both DiscardFunding and SpliceFailed are emitted for the same channel,
15171-
// DiscardFunding must come first so that inputs are unlocked before any retry.
15172-
// Each pair is emitted adjacently under a single lock, so checking adjacent
15173-
// events is sufficient.
15170+
// When both DiscardFunding and SpliceNegotiationFailed are emitted for the same
15171+
// channel, DiscardFunding must come first so that inputs are unlocked before any
15172+
// retry. Each pair is emitted adjacently under a single lock, so checking
15173+
// adjacent events is sufficient.
1517415174
for window in collected_events.windows(2) {
15175-
if let events::Event::SpliceFailed { channel_id, .. } = &window[0] {
15175+
if let events::Event::SpliceNegotiationFailed { channel_id, .. } = &window[0] {
1517615176
if let events::Event::DiscardFunding { channel_id: cid, .. } = &window[1] {
1517715177
assert!(
1517815178
channel_id != cid,
15179-
"DiscardFunding must precede SpliceFailed for channel {}",
15179+
"DiscardFunding must precede SpliceNegotiationFailed for channel {}",
1518015180
channel_id,
1518115181
);
1518215182
}
@@ -15463,7 +15463,7 @@ impl<
1546315463
funding_info,
1546415464
});
1546515465
}
15466-
splice_failed_events.push(events::Event::SpliceFailed {
15466+
splice_failed_events.push(events::Event::SpliceNegotiationFailed {
1546715467
channel_id: chan.context().channel_id(),
1546815468
counterparty_node_id,
1546915469
user_channel_id: chan.context().get_user_id(),
@@ -18119,8 +18119,9 @@ impl<
1811918119
let our_pending_intercepts = self.pending_intercepted_htlcs.lock().unwrap();
1812018120

1812118121
// Since some FundingNegotiation variants are not persisted, any splice in such state must
18122-
// be failed upon reload. However, as the necessary information for the SpliceFailed and
18123-
// DiscardFunding events is not persisted, the events need to be persisted even though they
18122+
// be failed upon reload. However, as the necessary information for the
18123+
// SpliceNegotiationFailed and DiscardFunding events is not persisted, the events need to
18124+
// be persisted even though they
1812418125
// haven't been emitted yet. These are removed after the events are written.
1812518126
let mut events = self.pending_events.lock().unwrap();
1812618127
let event_count = events.len();
@@ -18138,7 +18139,7 @@ impl<
1813818139
));
1813918140
}
1814018141
events.push_back((
18141-
events::Event::SpliceFailed {
18142+
events::Event::SpliceNegotiationFailed {
1814218143
channel_id: chan.context.channel_id(),
1814318144
counterparty_node_id: chan.context.get_counterparty_node_id(),
1814418145
user_channel_id: chan.context.get_user_id(),
@@ -18267,7 +18268,7 @@ impl<
1826718268
(23, self.best_block.read().unwrap().previous_blocks, required),
1826818269
});
1826918270

18270-
// Remove the SpliceFailed and DiscardFunding events added earlier.
18271+
// Remove the SpliceNegotiationFailed and DiscardFunding events added earlier.
1827118272
events.truncate(event_count);
1827218273

1827318274
Ok(())

lightning/src/ln/functional_test_utils.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2389,7 +2389,7 @@ pub fn check_closed_events(node: &Node, expected_close_events: &[ExpectedCloseEv
23892389
discard_events_count
23902390
);
23912391
assert_eq!(
2392-
events.iter().filter(|e| matches!(e, Event::SpliceFailed { .. },)).count(),
2392+
events.iter().filter(|e| matches!(e, Event::SpliceNegotiationFailed { .. },)).count(),
23932393
splice_events_count
23942394
);
23952395
}
@@ -3232,7 +3232,7 @@ pub fn expect_splice_pending_event<'a, 'b, 'c, 'd>(
32323232
let events = node.node.get_and_clear_pending_events();
32333233
assert_eq!(events.len(), 1);
32343234
match &events[0] {
3235-
crate::events::Event::SplicePending { channel_id, counterparty_node_id, .. } => {
3235+
crate::events::Event::SpliceNegotiated { channel_id, counterparty_node_id, .. } => {
32363236
assert_eq!(*expected_counterparty_node_id, *counterparty_node_id);
32373237
*channel_id
32383238
},
@@ -3261,7 +3261,7 @@ pub fn expect_splice_failed_events<'a, 'b, 'c, 'd>(
32613261
_ => panic!("Unexpected event"),
32623262
}
32633263
match &events[1] {
3264-
Event::SpliceFailed { channel_id, reason, contribution, .. } => {
3264+
Event::SpliceNegotiationFailed { channel_id, reason, contribution, .. } => {
32653265
assert_eq!(*expected_channel_id, *channel_id);
32663266
assert_eq!(expected_reason, *reason);
32673267
assert_eq!(contribution.as_ref(), Some(&funding_contribution));

lightning/src/ln/funding.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,10 @@ pub enum FundingContributionError {
120120
///
121121
/// Note: [`FundingTemplate::min_rbf_feerate`] may be derived from an in-progress
122122
/// negotiation that later aborts, leaving a stale (higher than necessary) minimum. If
123-
/// this error occurs after receiving [`Event::SpliceFailed`], call
123+
/// this error occurs after receiving [`Event::SpliceNegotiationFailed`], call
124124
/// [`ChannelManager::splice_channel`] again to get a fresh template.
125125
///
126-
/// [`Event::SpliceFailed`]: crate::events::Event::SpliceFailed
126+
/// [`Event::SpliceNegotiationFailed`]: crate::events::Event::SpliceNegotiationFailed
127127
/// [`ChannelManager::splice_channel`]: crate::ln::channelmanager::ChannelManager::splice_channel
128128
FeeRateBelowRbfMinimum {
129129
/// The requested feerate.

0 commit comments

Comments
 (0)