mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
json: allow helper to take/free psbt
Makes things a bit cleaner elsewhere
This commit is contained in:
committed by
Christian Decker
parent
e3a1d1a7f3
commit
713bb7491b
@@ -290,11 +290,13 @@ void json_add_tx(struct json_stream *result,
|
|||||||
|
|
||||||
void json_add_psbt(struct json_stream *stream,
|
void json_add_psbt(struct json_stream *stream,
|
||||||
const char *fieldname,
|
const char *fieldname,
|
||||||
const struct wally_psbt *psbt)
|
const struct wally_psbt *psbt TAKES)
|
||||||
{
|
{
|
||||||
const char *psbt_b64;
|
const char *psbt_b64;
|
||||||
psbt_b64 = psbt_to_b64(NULL, psbt);
|
psbt_b64 = psbt_to_b64(NULL, psbt);
|
||||||
json_add_string(stream, fieldname, take(psbt_b64));
|
json_add_string(stream, fieldname, take(psbt_b64));
|
||||||
|
if (taken(psbt))
|
||||||
|
tal_free(psbt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void json_add_amount_msat_compat(struct json_stream *result,
|
void json_add_amount_msat_compat(struct json_stream *result,
|
||||||
|
|||||||
Reference in New Issue
Block a user