psbt: if psbt is null, return null for get_bytes

This commit is contained in:
niftynei
2020-08-11 16:26:01 -05:00
committed by Rusty Russell
parent df7c122cb8
commit 0305c0a57e

View File

@@ -698,6 +698,11 @@ const u8 *psbt_get_bytes(const tal_t *ctx, const struct wally_psbt *psbt,
size_t len = 0; size_t len = 0;
u8 *bytes; u8 *bytes;
if (!psbt) {
*bytes_written = 0;
return NULL;
}
wally_psbt_get_length(psbt, 0, &len); wally_psbt_get_length(psbt, 0, &len);
bytes = tal_arr(ctx, u8, len); bytes = tal_arr(ctx, u8, len);