Browse Source

lightningd: EXPERIMENTAL_FEATURES: fix crash caused by test_sendonionmessage

Commit b0c9059602 broke the case where
next_node_id is NULL:

[libsecp256k1] illegal argument: pubkey != NULL
lightning_channeld: FATAL SIGNAL 6 (version 13d9c27)
0x55b4cd261b64 send_backtrace
	common/daemon.c:39
0x55b4cd261c0e crashdump
	common/daemon.c:52
0x7fc60307746f ???
	???:0
0x7fc6030773eb ???
	???:0
0x7fc603056898 ???
	???:0
0x55b4cd2c7cee ???
	???:0
0x55b4cd2d74d4 ???
	???:0
0x55b4cd26ac62 node_id_from_pubkey
	common/node_id.c:12
0x55b4cd24e194 handle_onion_message
	channeld/channeld.c:1890
0x55b4cd24e697 peer_in
	channeld/channeld.c:2001
0x55b4cd2521f4 main
	channeld/channeld.c:3419
0x7fc6030581e2 ???
	???:0
0x55b4cd24881d ???
	???:0
0xffffffffffffffff ???
	???:0

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
nifty/pset-pre
Rusty Russell 5 years ago
committed by Christian Decker
parent
commit
75a93ec32f
  1. 11
      channeld/channeld.c

11
channeld/channeld.c

@ -1879,7 +1879,7 @@ static void handle_onion_message(struct peer *peer, const u8 *msg)
path)));
} else {
struct pubkey *next_blinding;
struct node_id next_node;
struct node_id *next_node;
/* This *MUST* have instructions on where to go next. */
if (!om->next_short_channel_id && !om->next_node_id) {
@ -1888,7 +1888,6 @@ static void handle_onion_message(struct peer *peer, const u8 *msg)
return;
}
node_id_from_pubkey(&next_node, om->next_node_id);
if (blinding_ss) {
/* E(i-1) = H(E(i) || ss(i)) * E(i) */
struct sha256 h;
@ -1898,10 +1897,16 @@ static void handle_onion_message(struct peer *peer, const u8 *msg)
} else
next_blinding = NULL;
if (om->next_node_id) {
next_node = tal(tmpctx, struct node_id);
node_id_from_pubkey(next_node, om->next_node_id);
} else
next_node = NULL;
wire_sync_write(MASTER_FD,
take(towire_got_onionmsg_forward(NULL,
om->next_short_channel_id,
&next_node,
next_node,
next_blinding,
serialize_onionpacket(tmpctx, rs->next))));
}

Loading…
Cancel
Save