diff --git a/lightningd/onion_message.c b/lightningd/onion_message.c index 63269c441..1851b9509 100644 --- a/lightningd/onion_message.c +++ b/lightningd/onion_message.c @@ -28,7 +28,7 @@ static void onion_message_serialize(struct onion_message_hook_payload *payload, json_object_start(stream, NULL); json_add_pubkey(stream, "id", &payload->reply_path[i]->node_id); - if (payload->reply_path[i]->enctlv) + if (tal_bytelen(payload->reply_path[i]->enctlv) != 0) json_add_hex_talarr(stream, "enctlv", payload->reply_path[i]->enctlv); if (i == 0) diff --git a/openingd/openingd.c b/openingd/openingd.c index 113210d8c..d12850fd2 100644 --- a/openingd/openingd.c +++ b/openingd/openingd.c @@ -329,6 +329,16 @@ static void set_remote_upfront_shutdown(struct state *state, state->their_features, OPT_SHUTDOWN_ANYSEGWIT); + /* BOLT #2: + * + * - MUST include `upfront_shutdown_script` with either a valid + * `shutdown_scriptpubkey` as required by `shutdown` `scriptpubkey`, + * or a zero-length `shutdown_scriptpubkey` (ie. `0x0000`). + */ + /* We turn empty into NULL. */ + if (tal_bytelen(shutdown_scriptpubkey) == 0) + shutdown_scriptpubkey = tal_free(shutdown_scriptpubkey); + state->upfront_shutdown_script[REMOTE] = tal_steal(state, shutdown_scriptpubkey);