dualopend: handle ANNOUNCEMENT_SIGNATURES from peer.

This can happen if we haven't transitioned to channeld yet, but logic is simply to hand
it to lightningd, exactly as channeld does.

```
2025-09-30T03:04:57.8951627Z lightningd-1 2025-09-30T02:59:14.150Z DEBUG   022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59-dualopend-chan#1: peer_out WIRE_WARNING
2025-09-30T03:04:57.8952126Z lightningd-1 2025-09-30T02:59:14.150Z **BROKEN** 022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59-dualopend-chan#1: Unexpected message WIRE_ANNOUNCEMENT_SIGNATURES
2025-09-30T03:04:57.8952521Z lightningd-1 2025-09-30T02:59:14.150Z INFO    022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59-dualopend-chan#1: Peer connection lost
2025-09-30T03:04:57.8953124Z lightningd-1 2025-09-30T02:59:14.150Z INFO    022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59-chan#1: Peer transient failure in DUALOPEND_AWAITING_LOCKIN: dualopend: Owning subdaemon dualopend died (62208)
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2025-09-30 13:59:11 +09:30
parent 694626f050
commit 89bce95138
3 changed files with 54 additions and 1 deletions

View File

@@ -3696,6 +3696,28 @@ static void handle_commit_received(struct subd *dualopend,
abort();
}
static void handle_dualopend_got_announcement(struct subd *dualopend, const u8 *msg)
{
struct channel *channel = dualopend->channel;
secp256k1_ecdsa_signature remote_ann_node_sig;
secp256k1_ecdsa_signature remote_ann_bitcoin_sig;
struct short_channel_id scid;
if (!fromwire_dualopend_got_announcement(msg,
&scid,
&remote_ann_node_sig,
&remote_ann_bitcoin_sig)) {
channel_internal_error(channel,
"bad dualopend_got_announcement %s",
tal_hex(tmpctx, msg));
return;
}
channel_gossip_got_announcement_sigs(channel, scid,
&remote_ann_node_sig,
&remote_ann_bitcoin_sig);
}
static unsigned int dual_opend_msg(struct subd *dualopend,
const u8 *msg, const int *fds)
{
@@ -3758,6 +3780,9 @@ static unsigned int dual_opend_msg(struct subd *dualopend,
case WIRE_DUALOPEND_UPDATE_REQUIRE_CONFIRMED:
handle_update_require_confirmed(dualopend, msg);
return 0;
case WIRE_DUALOPEND_GOT_ANNOUNCEMENT:
handle_dualopend_got_announcement(dualopend, msg);
return 0;
/* Messages we send */
case WIRE_DUALOPEND_INIT:
case WIRE_DUALOPEND_REINIT:

View File

@@ -4169,12 +4169,33 @@ static u8 *handle_master_in(struct state *state)
case WIRE_DUALOPEND_VALIDATE_LEASE:
case WIRE_DUALOPEND_VALIDATE_INPUTS:
case WIRE_DUALOPEND_UPDATE_REQUIRE_CONFIRMED:
case WIRE_DUALOPEND_GOT_ANNOUNCEMENT:
break;
}
status_failed(STATUS_FAIL_MASTER_IO,
"Unknown msg %s", tal_hex(tmpctx, msg));
}
static void handle_announcement_signatures(struct state *state, const u8 *msg)
{
struct channel_id chanid;
struct short_channel_id remote_scid;
secp256k1_ecdsa_signature remote_node_sig, remote_bitcoin_sig;
if (!fromwire_announcement_signatures(msg,
&chanid,
&remote_scid,
&remote_node_sig,
&remote_bitcoin_sig))
open_err_fatal(state, "Bad announcement_signatures %s", tal_hex(msg, msg));
wire_sync_write(REQ_FD,
take(towire_dualopend_got_announcement(NULL,
remote_scid,
&remote_node_sig,
&remote_bitcoin_sig)));
}
/*~ Standard "peer sent a message, handle it" demuxer. Though it really only
* handles a few messages, we use the standard form as principle of least
* surprise. */
@@ -4221,6 +4242,9 @@ static u8 *handle_peer_in(struct state *state)
case WIRE_TX_ABORT:
handle_tx_abort(state, msg);
return NULL;
case WIRE_ANNOUNCEMENT_SIGNATURES:
handle_announcement_signatures(state, msg);
return NULL;
/* Otherwise we fall through */
case WIRE_INIT:
case WIRE_ERROR:
@@ -4239,7 +4263,6 @@ static u8 *handle_peer_in(struct state *state)
case WIRE_UPDATE_FEE:
case WIRE_UPDATE_BLOCKHEIGHT:
case WIRE_CHANNEL_REESTABLISH:
case WIRE_ANNOUNCEMENT_SIGNATURES:
case WIRE_GOSSIP_TIMESTAMP_FILTER:
case WIRE_ONION_MESSAGE:
case WIRE_ACCEPT_CHANNEL2:

View File

@@ -288,3 +288,8 @@ msgdata,dualopend_validate_lease,their_pubkey,pubkey,
msgtype,dualopend_validate_lease_reply,7127
msgdata,dualopend_validate_lease_reply,err_msg,?wirestring,
msgtype,dualopend_got_announcement,7031
msgdata,dualopend_got_announcement,scid,short_channel_id,
msgdata,dualopend_got_announcement,remote_ann_node_sig,secp256k1_ecdsa_signature,
msgdata,dualopend_got_announcement,remote_ann_bitcoin_sig,secp256k1_ecdsa_signature,
1 #include <bitcoin/chainparams.h>
288
289
290
291
292
293
294
295