mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 18:11:28 +01:00
offers: don't crash in decode if there's no signature on the offer.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
424ac84263
commit
d4c441f1d7
@ -368,9 +368,14 @@ static void json_add_offer(struct json_stream *js, const struct tlv_offer *offer
|
||||
json_object_end(js);
|
||||
}
|
||||
|
||||
/* offer_decode fails if node_id or signature not set */
|
||||
json_add_pubkey32(js, "node_id", offer->node_id);
|
||||
json_add_bip340sig(js, "signature", offer->signature);
|
||||
if (offer->node_id)
|
||||
json_add_pubkey32(js, "node_id", offer->node_id);
|
||||
else
|
||||
valid = false;
|
||||
|
||||
/* If it's present, offer_decode checked it was valid */
|
||||
if (offer->signature)
|
||||
json_add_bip340sig(js, "signature", offer->signature);
|
||||
|
||||
json_add_bool(js, "valid", valid);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user