Skip to content

Commit 4b5ac6e

Browse files
committed
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 <[email protected]>
1 parent 1703b03 commit 4b5ac6e

File tree

3 files changed

+54
-1
lines changed

3 files changed

+54
-1
lines changed

lightningd/dual_open_control.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3696,6 +3696,28 @@ static void handle_commit_received(struct subd *dualopend,
36963696
abort();
36973697
}
36983698

3699+
static void handle_dualopend_got_announcement(struct subd *dualopend, const u8 *msg)
3700+
{
3701+
struct channel *channel = dualopend->channel;
3702+
secp256k1_ecdsa_signature remote_ann_node_sig;
3703+
secp256k1_ecdsa_signature remote_ann_bitcoin_sig;
3704+
struct short_channel_id scid;
3705+
3706+
if (!fromwire_dualopend_got_announcement(msg,
3707+
&scid,
3708+
&remote_ann_node_sig,
3709+
&remote_ann_bitcoin_sig)) {
3710+
channel_internal_error(channel,
3711+
"bad dualopend_got_announcement %s",
3712+
tal_hex(tmpctx, msg));
3713+
return;
3714+
}
3715+
3716+
channel_gossip_got_announcement_sigs(channel, scid,
3717+
&remote_ann_node_sig,
3718+
&remote_ann_bitcoin_sig);
3719+
}
3720+
36993721
static unsigned int dual_opend_msg(struct subd *dualopend,
37003722
const u8 *msg, const int *fds)
37013723
{
@@ -3758,6 +3780,9 @@ static unsigned int dual_opend_msg(struct subd *dualopend,
37583780
case WIRE_DUALOPEND_UPDATE_REQUIRE_CONFIRMED:
37593781
handle_update_require_confirmed(dualopend, msg);
37603782
return 0;
3783+
case WIRE_DUALOPEND_GOT_ANNOUNCEMENT:
3784+
handle_dualopend_got_announcement(dualopend, msg);
3785+
return 0;
37613786
/* Messages we send */
37623787
case WIRE_DUALOPEND_INIT:
37633788
case WIRE_DUALOPEND_REINIT:

openingd/dualopend.c

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4169,12 +4169,33 @@ static u8 *handle_master_in(struct state *state)
41694169
case WIRE_DUALOPEND_VALIDATE_LEASE:
41704170
case WIRE_DUALOPEND_VALIDATE_INPUTS:
41714171
case WIRE_DUALOPEND_UPDATE_REQUIRE_CONFIRMED:
4172+
case WIRE_DUALOPEND_GOT_ANNOUNCEMENT:
41724173
break;
41734174
}
41744175
status_failed(STATUS_FAIL_MASTER_IO,
41754176
"Unknown msg %s", tal_hex(tmpctx, msg));
41764177
}
41774178

4179+
static void handle_announcement_signatures(struct state *state, const u8 *msg)
4180+
{
4181+
struct channel_id chanid;
4182+
struct short_channel_id remote_scid;
4183+
secp256k1_ecdsa_signature remote_node_sig, remote_bitcoin_sig;
4184+
4185+
if (!fromwire_announcement_signatures(msg,
4186+
&chanid,
4187+
&remote_scid,
4188+
&remote_node_sig,
4189+
&remote_bitcoin_sig))
4190+
open_err_fatal(state, "Bad announcement_signatures %s", tal_hex(msg, msg));
4191+
4192+
wire_sync_write(REQ_FD,
4193+
take(towire_dualopend_got_announcement(NULL,
4194+
remote_scid,
4195+
&remote_node_sig,
4196+
&remote_bitcoin_sig)));
4197+
}
4198+
41784199
/*~ Standard "peer sent a message, handle it" demuxer. Though it really only
41794200
* handles a few messages, we use the standard form as principle of least
41804201
* surprise. */
@@ -4221,6 +4242,9 @@ static u8 *handle_peer_in(struct state *state)
42214242
case WIRE_TX_ABORT:
42224243
handle_tx_abort(state, msg);
42234244
return NULL;
4245+
case WIRE_ANNOUNCEMENT_SIGNATURES:
4246+
handle_announcement_signatures(state, msg);
4247+
return NULL;
42244248
/* Otherwise we fall through */
42254249
case WIRE_INIT:
42264250
case WIRE_ERROR:
@@ -4239,7 +4263,6 @@ static u8 *handle_peer_in(struct state *state)
42394263
case WIRE_UPDATE_FEE:
42404264
case WIRE_UPDATE_BLOCKHEIGHT:
42414265
case WIRE_CHANNEL_REESTABLISH:
4242-
case WIRE_ANNOUNCEMENT_SIGNATURES:
42434266
case WIRE_GOSSIP_TIMESTAMP_FILTER:
42444267
case WIRE_ONION_MESSAGE:
42454268
case WIRE_ACCEPT_CHANNEL2:

openingd/dualopend_wire.csv

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,3 +288,8 @@ msgdata,dualopend_validate_lease,their_pubkey,pubkey,
288288

289289
msgtype,dualopend_validate_lease_reply,7127
290290
msgdata,dualopend_validate_lease_reply,err_msg,?wirestring,
291+
292+
msgtype,dualopend_got_announcement,7031
293+
msgdata,dualopend_got_announcement,scid,short_channel_id,
294+
msgdata,dualopend_got_announcement,remote_ann_node_sig,secp256k1_ecdsa_signature,
295+
msgdata,dualopend_got_announcement,remote_ann_bitcoin_sig,secp256k1_ecdsa_signature,

0 commit comments

Comments
 (0)