Skip to content

Commit 6845e4f

Browse files
committed
Forced error at the end of use case
1 parent fea86b8 commit 6845e4f

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

lightning/src/ln/channel.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2723,6 +2723,14 @@ pub(super) trait FundingTxConstructorV2<SP: Deref>: ChannelContextProvider<SP> w
27232723
self.pending_funding_mut()
27242724
.channel_transaction_parameters.funding_outpoint = Some(outpoint);
27252725

2726+
if self.is_splice() {
2727+
// TODO(splicing) Forced error, as the use case is not complete
2728+
return Err(ChannelError::Close((
2729+
"TODO Forced error, incomplete implementation".into(),
2730+
ClosureReason::HolderForceClosed { broadcasted_latest_txn: Some(false) }
2731+
)));
2732+
}
2733+
27262734
self.context().assert_no_commitment_advancement(transaction_number, "initial commitment_signed");
27272735
let (funding, context_mut) = self.pending_funding_and_context_mut();
27282736
let commitment_signed = context_mut.get_initial_commitment_signed(&funding, logger);

lightning/src/ln/splicing_tests.rs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,11 +230,21 @@ fn test_v1_splice_in() {
230230
initiator_node.node.get_our_node_id()
231231
);
232232

233-
// TODO(splicing) This is the last tx_complete, which triggers the commitment flow, which is not yet implemented
234-
// let _res = initiator_node.node.handle_tx_complete(acceptor_node.node.get_our_node_id(), &tx_complete_msg);
233+
// TODO(splicing) This is the last tx_complete, which triggers the commitment flow, which is not yet fully implemented
234+
let _res = initiator_node.node.handle_tx_complete(acceptor_node.node.get_our_node_id(), &tx_complete_msg);
235+
let events = initiator_node.node.get_and_clear_pending_msg_events();
236+
assert_eq!(events.len(), 2);
237+
match events[0] {
238+
MessageSendEvent::SendTxComplete { .. } => {},
239+
_ => panic!("Unexpected event {:?}", events[0]),
240+
}
241+
match events[1] {
242+
MessageSendEvent::HandleError { .. } => {},
243+
_ => panic!("Unexpected event {:?}", events[1]),
244+
}
235245

236246
// TODO(splicing): Continue with commitment flow, new tx confirmation
237-
247+
/*
238248
// === Close channel, cooperatively
239249
initiator_node.node.close_channel(&channel_id, &acceptor_node.node.get_our_node_id()).unwrap();
240250
let node0_shutdown_message = get_event_msg!(
@@ -256,6 +266,7 @@ fn test_v1_splice_in() {
256266
MessageSendEvent::SendClosingSigned,
257267
acceptor_node.node.get_our_node_id()
258268
);
269+
*/
259270
}
260271

261272
#[test]

0 commit comments

Comments
 (0)