From e366c19d0948d5669906ce511401d84bcdff740b Mon Sep 17 00:00:00 2001 From: niftynei Date: Fri, 7 Jul 2023 01:10:06 -0500 Subject: [PATCH] dual-fund: send the next_funding_txid to peer As per https://github.com/lightning/bolts/commit/cd3c99e72201d26a5ec9ab65c39aaf6241db7aab we should send the next_funding_txid if we've sent our commitment sigs, but we haven't received the peer's tx_signatures. Note that we send here, but don't verify that it's arrived. --- openingd/dualopend.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/openingd/dualopend.c b/openingd/dualopend.c index fc20d7d3d..17b045366 100644 --- a/openingd/dualopend.c +++ b/openingd/dualopend.c @@ -3978,10 +3978,26 @@ static void do_reconnect_dance(struct state *state) sizeof(last_remote_per_commit_secret)); /* We always send reconnect/reestablish */ + + /* BOLT-e299850cb5ebd8bd9c55763bbc498fcdf94a9567 #2: + * + * - if it has sent `commitment_signed` for an + * interactive transaction construction but it has + * not received `tx_signatures`: + * - MUST set `next_funding_txid` to the txid of that + * interactive transaction. + * - otherwise: + * - MUST NOT set `next_funding_txid`. + */ + tlvs = tlv_channel_reestablish_tlvs_new(tmpctx); + if (!tx_state->remote_funding_sigs_rcvd) + tlvs->next_funding = &tx_state->funding.txid; + msg = towire_channel_reestablish (NULL, &state->channel_id, 1, 0, &last_remote_per_commit_secret, - &state->first_per_commitment_point[LOCAL], NULL); + &state->first_per_commitment_point[LOCAL], tlvs); + peer_write(state->pps, take(msg)); peer_billboard(false, "Sent reestablish, waiting for theirs");