mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-22 06:41:44 +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
1 changed files with 8 additions and 3 deletions
|
@ -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…
Add table
Reference in a new issue