mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
json: add "json-to-psbt" helper
Pull a PSBT out of a json buffer
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
#include <common/type_to_string.h>
|
||||
#include <common/wireaddr.h>
|
||||
#include <errno.h>
|
||||
#include <wally_psbt.h>
|
||||
|
||||
bool json_to_bitcoin_amount(const char *buffer, const jsmntok_t *tok,
|
||||
uint64_t *satoshi)
|
||||
@@ -127,6 +128,13 @@ bool json_to_preimage(const char *buffer, const jsmntok_t *tok, struct preimage
|
||||
return hex_decode(buffer + tok->start, hexlen, preimage->r, sizeof(preimage->r));
|
||||
}
|
||||
|
||||
bool json_to_psbt(const tal_t *ctx, const char *buffer,
|
||||
const jsmntok_t *tok, struct wally_psbt **dest)
|
||||
{
|
||||
*dest = psbt_from_b64(ctx, buffer + tok->start, tok->end - tok->start);
|
||||
return dest != NULL;
|
||||
}
|
||||
|
||||
void json_add_node_id(struct json_stream *response,
|
||||
const char *fieldname,
|
||||
const struct node_id *id)
|
||||
|
||||
Reference in New Issue
Block a user