Skip to content

Commit e9510ad

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 8dda7a1 commit e9510ad

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
@@ -1603,8 +1603,8 @@ pub enum Event {
16031603
/// # Failure Behavior and Persistence
16041604
/// This event will eventually be replayed after failures-to-handle (i.e., the event handler
16051605
/// returning `Err(ReplayEvent ())`) and will be persisted across restarts.
1606-
SplicePending {
1607-
/// The `channel_id` of the channel that has a pending splice funding transaction.
1606+
SpliceNegotiated {
1607+
/// The `channel_id` of the channel with the negotiated splice funding transaction.
16081608
channel_id: ChannelId,
16091609
/// The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
16101610
/// channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels.
@@ -1624,7 +1624,7 @@ pub enum Event {
16241624
},
16251625
/// Used to indicate that a splice negotiation round for the given `channel_id` has failed.
16261626
///
1627-
/// Each splice attempt (initial or RBF) resolves to either [`Event::SplicePending`] on
1627+
/// Each splice attempt (initial or RBF) resolves to either [`Event::SpliceNegotiated`] on
16281628
/// success or this event on failure. Prior successfully negotiated splice transactions are
16291629
/// unaffected.
16301630
///
@@ -1634,7 +1634,7 @@ pub enum Event {
16341634
/// # Failure Behavior and Persistence
16351635
/// This event will eventually be replayed after failures-to-handle (i.e., the event handler
16361636
/// returning `Err(ReplayEvent ())`) and will be persisted across restarts.
1637-
SpliceFailed {
1637+
SpliceNegotiationFailed {
16381638
/// The `channel_id` of the channel for which the splice negotiation round failed.
16391639
channel_id: ChannelId,
16401640
/// The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
@@ -2425,7 +2425,7 @@ impl Writeable for Event {
24252425
// We never write out FundingTransactionReadyForSigning events as they will be regenerated when
24262426
// necessary.
24272427
},
2428-
&Event::SplicePending {
2428+
&Event::SpliceNegotiated {
24292429
ref channel_id,
24302430
ref user_channel_id,
24312431
ref counterparty_node_id,
@@ -2443,7 +2443,7 @@ impl Writeable for Event {
24432443
(11, new_funding_redeem_script, required),
24442444
});
24452445
},
2446-
&Event::SpliceFailed {
2446+
&Event::SpliceNegotiationFailed {
24472447
ref channel_id,
24482448
ref user_channel_id,
24492449
ref counterparty_node_id,
@@ -3082,7 +3082,7 @@ impl MaybeReadable for Event {
30823082
(11, new_funding_redeem_script, required),
30833083
});
30843084

3085-
Ok(Some(Event::SplicePending {
3085+
Ok(Some(Event::SpliceNegotiated {
30863086
channel_id: channel_id.0.unwrap(),
30873087
user_channel_id: user_channel_id.0.unwrap(),
30883088
counterparty_node_id: counterparty_node_id.0.unwrap(),
@@ -3103,7 +3103,7 @@ impl MaybeReadable for Event {
31033103
(13, contribution, option),
31043104
});
31053105

3106-
Ok(Some(Event::SpliceFailed {
3106+
Ok(Some(Event::SpliceNegotiationFailed {
31073107
channel_id: channel_id.0.unwrap(),
31083108
user_channel_id: user_channel_id.0.unwrap(),
31093109
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(),
@@ -11862,7 +11862,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
1186211862
None,
1186311863
));
1186411864
pending_events.push_back((
11865-
events::Event::SpliceFailed {
11865+
events::Event::SpliceNegotiationFailed {
1186611866
channel_id,
1186711867
counterparty_node_id: *counterparty_node_id,
1186811868
user_channel_id: channel.context().get_user_id(),
@@ -12021,7 +12021,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
1202112021
None,
1202212022
));
1202312023
pending_events.push_back((
12024-
events::Event::SpliceFailed {
12024+
events::Event::SpliceNegotiationFailed {
1202512025
channel_id: msg.channel_id,
1202612026
counterparty_node_id,
1202712027
user_channel_id: chan.context().get_user_id(),
@@ -12108,7 +12108,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
1210812108
let exited_quiescence = splice_negotiated.is_some();
1210912109
if let Some(splice_negotiated) = splice_negotiated {
1211012110
self.pending_events.lock().unwrap().push_back((
12111-
events::Event::SplicePending {
12111+
events::Event::SpliceNegotiated {
1211212112
channel_id: msg.channel_id,
1211312113
counterparty_node_id: *counterparty_node_id,
1211412114
user_channel_id: chan.context.get_user_id(),
@@ -12191,7 +12191,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
1219112191
None,
1219212192
));
1219312193
pending_events.push_back((
12194-
events::Event::SpliceFailed {
12194+
events::Event::SpliceNegotiationFailed {
1219512195
channel_id: msg.channel_id,
1219612196
counterparty_node_id: *counterparty_node_id,
1219712197
user_channel_id: chan_entry.get().context().get_user_id(),
@@ -12339,7 +12339,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
1233912339
None,
1234012340
));
1234112341
pending_events.push_back((
12342-
events::Event::SpliceFailed {
12342+
events::Event::SpliceNegotiationFailed {
1234312343
channel_id: msg.channel_id,
1234412344
counterparty_node_id: *counterparty_node_id,
1234512345
user_channel_id: chan.context().get_user_id(),
@@ -15452,7 +15452,7 @@ impl<
1545215452
outputs: splice_funding_failed.contributed_outputs,
1545315453
},
1545415454
});
15455-
splice_failed_events.push(events::Event::SpliceFailed {
15455+
splice_failed_events.push(events::Event::SpliceNegotiationFailed {
1545615456
channel_id: chan.context().channel_id(),
1545715457
counterparty_node_id,
1545815458
user_channel_id: chan.context().get_user_id(),
@@ -18108,8 +18108,9 @@ impl<
1810818108
let our_pending_intercepts = self.pending_intercepted_htlcs.lock().unwrap();
1810918109

1811018110
// Since some FundingNegotiation variants are not persisted, any splice in such state must
18111-
// be failed upon reload. However, as the necessary information for the SpliceFailed and
18112-
// DiscardFunding events is not persisted, the events need to be persisted even though they
18111+
// be failed upon reload. However, as the necessary information for the
18112+
// SpliceNegotiationFailed and DiscardFunding events is not persisted, the events need to
18113+
// be persisted even though they
1811318114
// haven't been emitted yet. These are removed after the events are written.
1811418115
let mut events = self.pending_events.lock().unwrap();
1811518116
let event_count = events.len();
@@ -18127,7 +18128,7 @@ impl<
1812718128
None,
1812818129
));
1812918130
events.push_back((
18130-
events::Event::SpliceFailed {
18131+
events::Event::SpliceNegotiationFailed {
1813118132
channel_id: chan.context.channel_id(),
1813218133
counterparty_node_id: chan.context.get_counterparty_node_id(),
1813318134
user_channel_id: chan.context.get_user_id(),
@@ -18256,7 +18257,7 @@ impl<
1825618257
(23, self.best_block.read().unwrap().previous_blocks, required),
1825718258
});
1825818259

18259-
// Remove the SpliceFailed and DiscardFunding events added earlier.
18260+
// Remove the SpliceNegotiationFailed and DiscardFunding events added earlier.
1826018261
events.truncate(event_count);
1826118262

1826218263
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)