Skip to content

Commit ef69437

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 3a10d37 commit ef69437

9 files changed

Lines changed: 71 additions & 70 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
@@ -1601,8 +1601,8 @@ pub enum Event {
16011601
/// # Failure Behavior and Persistence
16021602
/// This event will eventually be replayed after failures-to-handle (i.e., the event handler
16031603
/// returning `Err(ReplayEvent ())`) and will be persisted across restarts.
1604-
SplicePending {
1605-
/// The `channel_id` of the channel that has a pending splice funding transaction.
1604+
SpliceNegotiated {
1605+
/// The `channel_id` of the channel with the negotiated splice funding transaction.
16061606
channel_id: ChannelId,
16071607
/// The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
16081608
/// channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels.
@@ -1622,7 +1622,7 @@ pub enum Event {
16221622
},
16231623
/// Used to indicate that a splice negotiation round for the given `channel_id` has failed.
16241624
///
1625-
/// Each splice attempt (initial or RBF) resolves to either [`Event::SplicePending`] on
1625+
/// Each splice attempt (initial or RBF) resolves to either [`Event::SpliceNegotiated`] on
16261626
/// success or this event on failure. Prior successfully negotiated splice transactions are
16271627
/// unaffected.
16281628
///
@@ -1632,7 +1632,7 @@ pub enum Event {
16321632
/// # Failure Behavior and Persistence
16331633
/// This event will eventually be replayed after failures-to-handle (i.e., the event handler
16341634
/// returning `Err(ReplayEvent ())`) and will be persisted across restarts.
1635-
SpliceFailed {
1635+
SpliceNegotiationFailed {
16361636
/// The `channel_id` of the channel for which the splice negotiation round failed.
16371637
channel_id: ChannelId,
16381638
/// The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
@@ -2423,7 +2423,7 @@ impl Writeable for Event {
24232423
// We never write out FundingTransactionReadyForSigning events as they will be regenerated when
24242424
// necessary.
24252425
},
2426-
&Event::SplicePending {
2426+
&Event::SpliceNegotiated {
24272427
ref channel_id,
24282428
ref user_channel_id,
24292429
ref counterparty_node_id,
@@ -2441,7 +2441,7 @@ impl Writeable for Event {
24412441
(11, new_funding_redeem_script, required),
24422442
});
24432443
},
2444-
&Event::SpliceFailed {
2444+
&Event::SpliceNegotiationFailed {
24452445
ref channel_id,
24462446
ref user_channel_id,
24472447
ref counterparty_node_id,
@@ -3080,7 +3080,7 @@ impl MaybeReadable for Event {
30803080
(11, new_funding_redeem_script, required),
30813081
});
30823082

3083-
Ok(Some(Event::SplicePending {
3083+
Ok(Some(Event::SpliceNegotiated {
30843084
channel_id: channel_id.0.unwrap(),
30853085
user_channel_id: user_channel_id.0.unwrap(),
30863086
counterparty_node_id: counterparty_node_id.0.unwrap(),
@@ -3101,7 +3101,7 @@ impl MaybeReadable for Event {
31013101
(13, contribution, option),
31023102
});
31033103

3104-
Ok(Some(Event::SpliceFailed {
3104+
Ok(Some(Event::SpliceNegotiationFailed {
31053105
channel_id: channel_id.0.unwrap(),
31063106
user_channel_id: user_channel_id.0.unwrap(),
31073107
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: 4 additions & 4 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

@@ -12306,7 +12306,7 @@ where
1230612306
//
1230712307
// If the in-progress negotiation later fails (e.g., tx_abort), the derived
1230812308
// min_rbf_feerate becomes stale, causing a slightly higher feerate than
12309-
// necessary. Call splice_channel again after receiving SpliceFailed to get a
12309+
// necessary. Call splice_channel again after receiving SpliceNegotiationFailed to get a
1231012310
// fresh template without the stale RBF constraint.
1231112311
let prev_feerate =
1231212312
pending_splice.last_funding_feerate_sat_per_1000_weight.or_else(|| {

lightning/src/ln/channelmanager.rs

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4119,7 +4119,7 @@ impl<
41194119
None,
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
None,
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
None,
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(),
@@ -6629,7 +6629,7 @@ impl<
66296629
));
66306630
}
66316631
pending_events.push_back((
6632-
events::Event::SpliceFailed {
6632+
events::Event::SpliceNegotiationFailed {
66336633
channel_id,
66346634
counterparty_node_id,
66356635
user_channel_id,
@@ -6675,14 +6675,14 @@ impl<
66756675
/// # Events
66766676
///
66776677
/// Calling this method will commence the process of creating a new funding transaction for the
6678-
/// channel. Once the funding transaction has been constructed, an [`Event::SplicePending`]
6678+
/// channel. Once the funding transaction has been constructed, an [`Event::SpliceNegotiated`]
66796679
/// will be emitted. At this point, any inputs contributed to the splice can only be re-spent
66806680
/// if an [`Event::DiscardFunding`] is seen.
66816681
///
6682-
/// If any failures occur while negotiating the funding transaction, an [`Event::SpliceFailed`]
6683-
/// will be emitted. Any contributed inputs no longer used will be included in an
6684-
/// [`Event::DiscardFunding`] and thus can be re-spent. If a [`FundingTemplate`] was obtained
6685-
/// while a previous splice was still being negotiated, its
6682+
/// If any failures occur while negotiating the funding transaction, an
6683+
/// [`Event::SpliceNegotiationFailed`] will be emitted. Any contributed inputs no longer used
6684+
/// will be included in an [`Event::DiscardFunding`] and thus can be re-spent. If a
6685+
/// [`FundingTemplate`] was obtained while a previous splice was still being negotiated, its
66866686
/// [`min_rbf_feerate`][FundingTemplate::min_rbf_feerate] may be stale after the failure.
66876687
/// Call [`ChannelManager::splice_channel`] again to get a fresh template.
66886688
///
@@ -6901,7 +6901,7 @@ impl<
69016901
}
69026902
if let Some(splice_negotiated) = splice_negotiated {
69036903
self.pending_events.lock().unwrap().push_back((
6904-
events::Event::SplicePending {
6904+
events::Event::SpliceNegotiated {
69056905
channel_id: *channel_id,
69066906
counterparty_node_id: *counterparty_node_id,
69076907
user_channel_id: chan.context().get_user_id(),
@@ -10994,7 +10994,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
1099410994
.and_then(|v| v.splice_negotiated.take())
1099510995
{
1099610996
pending_events.push_back((
10997-
events::Event::SplicePending {
10997+
events::Event::SpliceNegotiated {
1099810998
channel_id: channel.context.channel_id(),
1099910999
counterparty_node_id,
1100011000
user_channel_id: channel.context.get_user_id(),
@@ -11864,7 +11864,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
1186411864
None,
1186511865
));
1186611866
pending_events.push_back((
11867-
events::Event::SpliceFailed {
11867+
events::Event::SpliceNegotiationFailed {
1186811868
channel_id,
1186911869
counterparty_node_id: *counterparty_node_id,
1187011870
user_channel_id: channel.context().get_user_id(),
@@ -12025,7 +12025,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
1202512025
None,
1202612026
));
1202712027
pending_events.push_back((
12028-
events::Event::SpliceFailed {
12028+
events::Event::SpliceNegotiationFailed {
1202912029
channel_id: msg.channel_id,
1203012030
counterparty_node_id,
1203112031
user_channel_id: chan.context().get_user_id(),
@@ -12112,7 +12112,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
1211212112
let exited_quiescence = splice_negotiated.is_some();
1211312113
if let Some(splice_negotiated) = splice_negotiated {
1211412114
self.pending_events.lock().unwrap().push_back((
12115-
events::Event::SplicePending {
12115+
events::Event::SpliceNegotiated {
1211612116
channel_id: msg.channel_id,
1211712117
counterparty_node_id: *counterparty_node_id,
1211812118
user_channel_id: chan.context.get_user_id(),
@@ -12195,7 +12195,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
1219512195
None,
1219612196
));
1219712197
pending_events.push_back((
12198-
events::Event::SpliceFailed {
12198+
events::Event::SpliceNegotiationFailed {
1219912199
channel_id: msg.channel_id,
1220012200
counterparty_node_id: *counterparty_node_id,
1220112201
user_channel_id: chan_entry.get().context().get_user_id(),
@@ -12343,7 +12343,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
1234312343
None,
1234412344
));
1234512345
pending_events.push_back((
12346-
events::Event::SpliceFailed {
12346+
events::Event::SpliceNegotiationFailed {
1234712347
channel_id: msg.channel_id,
1234812348
counterparty_node_id: *counterparty_node_id,
1234912349
user_channel_id: chan.context().get_user_id(),
@@ -15456,7 +15456,7 @@ impl<
1545615456
outputs: splice_funding_failed.contributed_outputs,
1545715457
},
1545815458
});
15459-
splice_failed_events.push(events::Event::SpliceFailed {
15459+
splice_failed_events.push(events::Event::SpliceNegotiationFailed {
1546015460
channel_id: chan.context().channel_id(),
1546115461
counterparty_node_id,
1546215462
user_channel_id: chan.context().get_user_id(),
@@ -18112,8 +18112,9 @@ impl<
1811218112
let our_pending_intercepts = self.pending_intercepted_htlcs.lock().unwrap();
1811318113

1811418114
// Since some FundingNegotiation variants are not persisted, any splice in such state must
18115-
// be failed upon reload. However, as the necessary information for the SpliceFailed and
18116-
// DiscardFunding events is not persisted, the events need to be persisted even though they
18115+
// be failed upon reload. However, as the necessary information for the
18116+
// SpliceNegotiationFailed and DiscardFunding events is not persisted, the events need to
18117+
// be persisted even though they
1811718118
// haven't been emitted yet. These are removed after the events are written.
1811818119
let mut events = self.pending_events.lock().unwrap();
1811918120
let event_count = events.len();
@@ -18131,7 +18132,7 @@ impl<
1813118132
None,
1813218133
));
1813318134
events.push_back((
18134-
events::Event::SpliceFailed {
18135+
events::Event::SpliceNegotiationFailed {
1813518136
channel_id: chan.context.channel_id(),
1813618137
counterparty_node_id: chan.context.get_counterparty_node_id(),
1813718138
user_channel_id: chan.context.get_user_id(),
@@ -18260,7 +18261,7 @@ impl<
1826018261
(23, self.best_block.read().unwrap().previous_blocks, required),
1826118262
});
1826218263

18263-
// Remove the SpliceFailed and DiscardFunding events added earlier.
18264+
// Remove the SpliceNegotiationFailed and DiscardFunding events added earlier.
1826418265
events.truncate(event_count);
1826518266

1826618267
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!(*reason, expected_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)