Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions channeld/channeld.c
Original file line number Diff line number Diff line change
Expand Up @@ -4224,6 +4224,16 @@ static void splice_accepter(struct peer *peer, const u8 *inmsg)
}
}
else if (type == WIRE_TX_INIT_RBF) {
/* BOLT #2:
* The sender:
* - MUST NOT send `tx_init_rbf` if `option_zeroconf`
* has been negotiated.
*/
if (channel_type_has(peer->channel->type, OPT_ZEROCONF))
peer_failed_warn(peer->pps, &peer->channel_id,
"Peer sent tx_init_rbf but channel"
" uses option_zeroconf");

if (!fromwire_tx_init_rbf(tmpctx, inmsg,
&channel_id,
&locktime,
Expand Down Expand Up @@ -4918,6 +4928,16 @@ static void handle_splice_stfu_success(struct peer *peer)
&peer->channel->funding_pubkey[LOCAL]);
}
else { /* RBF attempt */
/* BOLT #2:
* The sender:
* - MUST NOT send `tx_init_rbf` if `option_zeroconf`
* has been negotiated.
*/
if (channel_type_has(peer->channel->type, OPT_ZEROCONF))
peer_failed_warn(peer->pps, &peer->channel_id,
"Cannot RBF splice: channel uses"
" option_zeroconf");

Comment thread
vincenzopalazzo marked this conversation as resolved.
Outdated
init_rbf_tlvs = tlv_tx_init_rbf_tlvs_new(tmpctx);
init_rbf_tlvs->funding_output_contribution = tal(init_rbf_tlvs, s64);
*init_rbf_tlvs->funding_output_contribution = peer->splicing->opener_relative;
Expand Down
7 changes: 7 additions & 0 deletions lightningd/channel_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,13 @@ static enum watch_result splice_depth_cb(struct lightningd *ld,
return DELETE_WATCH;
}

/* Reorged out? OK, we're not committed yet.
* But for zero-conf channels (minimum_depth == 0), depth 0 means
* we should send splice_locked immediately per BOLT #2. */
if (depth == 0 && inflight->channel->minimum_depth != 0) {
return KEEP_WATCHING;
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not the right place to be trying to do zero-conf. Instead we should initiate splice_locked in channeld right after sending tx_signatures which occurs in resume_splice_negotiation.

This needs to be done with extra care because this flow can occur from initiate, accepter, or during the reestablish flow. We need to make sure it's behaving correctly in each of these flows.

Probably the best approach is to take the code in handle_funding_depth that confirms the splice and move it out into it's own function so that we can additionally call it from resume_splice_negotiation.

It would be very important to duplicate the tests in test_splicing_disconnect.py with this new zero conf splice setting enabled.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 7bd121c.

I moved zero-conf splice_locked initiation into resume_splice_negotiation() so we send it immediately after each local tx_signatures write, which covers the initiator, accepter, and reestablish paths in one place. For the reconnect cases I also persist i_sent_sigs, cache early splice_locked until the local signature path is complete, and treat channel_ready during zero-conf reestablish as an implied peer splice_locked once we have already sent ours.

I also duplicated the disconnect regressions for zero-conf in tests/test_splicing_disconnect.py and re-ran the zero-conf happy-path splice test. Verified with targeted runs of test_splice_zeroconf, test_splice_disconnect_sig_zeroconf, and test_splice_disconnect_commit_zeroconf.

if (inflight->channel->owner) {
log_debug(inflight->channel->log, "splice_depth_cb: sending funding depth scid: %s",
fmt_short_channel_id(tmpctx, *inflight->scid));
Expand Down
Loading