Skip to content

Commit 28851bf

Browse files
committed
splice: Update locked_txid on restart
Use the inflight information to set a correct `locked_txid` value on restart. This is critical for handling interrupted `splice_locked` events that need to be resumed on reconnect/reestablish.
1 parent 957339b commit 28851bf

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

channeld/channeld.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6155,6 +6155,21 @@ static void init_channel(struct peer *peer)
61556155
peer->final_ext_key = tal_dup(peer, struct ext_key, &final_ext_key);
61566156
peer->splice_state->count = tal_count(peer->splice_state->inflights);
61576157

6158+
found_locked_inflight = false;
6159+
for (size_t i = 0; i < tal_count(peer->splice_state->inflights); i++) {
6160+
if (peer->splice_state->inflights[i]->is_locked) {
6161+
if (found_locked_inflight)
6162+
status_failed(STATUS_FAIL_INTERNAL_ERROR,
6163+
"There should never be two splice"
6164+
" candidates locked on chain at"
6165+
" once. First %s. Second %s",
6166+
fmt_bitcoin_txid(tmpctx, &peer->splice_state->locked_txid),
6167+
fmt_bitcoin_txid(tmpctx, &peer->splice_state->inflights[i]->outpoint.txid));
6168+
peer->splice_state->locked_txid = peer->splice_state->inflights[i]->outpoint.txid;
6169+
found_locked_inflight = true;
6170+
}
6171+
}
6172+
61586173
status_debug("option_static_remotekey = %u,"
61596174
" option_anchor_outputs = %u"
61606175
" option_anchors_zero_fee_htlc_tx = %u",

0 commit comments

Comments
 (0)