mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-26 01:04:20 +01:00
txprepare: return psbt serialized version of tx as well
Changelog-Added: JSON-API: `txprepare` returns a psbt version of the created transaction
This commit is contained in:
committed by
Rusty Russell
parent
bf4cac7fb8
commit
1fb9a078b6
@@ -240,6 +240,15 @@ void json_add_tx(struct json_stream *result,
|
||||
json_add_hex_talarr(result, fieldname, linearize_tx(tmpctx, tx));
|
||||
}
|
||||
|
||||
void json_add_psbt(struct json_stream *stream,
|
||||
const char *fieldname,
|
||||
struct bitcoin_tx *tx)
|
||||
{
|
||||
const char *psbt_b64;
|
||||
psbt_b64 = bitcoin_tx_to_psbt_base64(tx, tx);
|
||||
json_add_string(stream, fieldname, take(psbt_b64));
|
||||
}
|
||||
|
||||
void json_add_amount_msat_compat(struct json_stream *result,
|
||||
struct amount_msat msat,
|
||||
const char *rawfieldname,
|
||||
|
||||
@@ -137,4 +137,10 @@ void json_add_preimage(struct json_stream *result, const char *fieldname,
|
||||
void json_add_tx(struct json_stream *result,
|
||||
const char *fieldname,
|
||||
const struct bitcoin_tx *tx);
|
||||
|
||||
/* '"fieldname" : "cHNidP8BAJoCAAAAAljo..." or "cHNidP8BAJoCAAAAAljo..." if fieldname is NULL */
|
||||
void json_add_psbt(struct json_stream *stream,
|
||||
const char *fieldname,
|
||||
struct bitcoin_tx *tx);
|
||||
|
||||
#endif /* LIGHTNING_COMMON_JSON_HELPERS_H */
|
||||
|
||||
Reference in New Issue
Block a user