mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
listfunds: add "redeemscript" field.
You'd need this if you ever wanted to make your own PSBT. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Changelog-Added: `listfunds` now has a `redeemscript` field for p2sh-wrapped outputs.
This commit is contained in:
committed by
neil saitug
parent
cf25ca11b8
commit
bcd632f2ae
2
doc/lightning-listfunds.7
generated
2
doc/lightning-listfunds.7
generated
@@ -35,6 +35,8 @@ appended)
|
|||||||
.IP \[bu]
|
.IP \[bu]
|
||||||
\fIscriptpubkey\fR (the ScriptPubkey of the output, in hex)
|
\fIscriptpubkey\fR (the ScriptPubkey of the output, in hex)
|
||||||
.IP \[bu]
|
.IP \[bu]
|
||||||
|
\fIredeemscript\fR (the redeemscript of the output, in hex, only if it's p2sh-wrapped)
|
||||||
|
.IP \[bu]
|
||||||
\fIstatus\fR (whether \fIunconfirmed\fR, \fIconfirmed\fR, or \fIspent\fR)
|
\fIstatus\fR (whether \fIunconfirmed\fR, \fIconfirmed\fR, or \fIspent\fR)
|
||||||
.IP \[bu]
|
.IP \[bu]
|
||||||
\fIreserved\fR (whether this is UTXO is currently reserved for an in-flight tx)
|
\fIreserved\fR (whether this is UTXO is currently reserved for an in-flight tx)
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ Each entry in *outputs* will include:
|
|||||||
appended)
|
appended)
|
||||||
- *address*
|
- *address*
|
||||||
- *scriptpubkey* (the ScriptPubkey of the output, in hex)
|
- *scriptpubkey* (the ScriptPubkey of the output, in hex)
|
||||||
|
- *redeemscript* (the redeemscript of the output, in hex, only if it's p2sh-wrapped)
|
||||||
- *status* (whether *unconfirmed*, *confirmed*, or *spent*)
|
- *status* (whether *unconfirmed*, *confirmed*, or *spent*)
|
||||||
- *reserved* (whether this is UTXO is currently reserved for an in-flight tx)
|
- *reserved* (whether this is UTXO is currently reserved for an in-flight tx)
|
||||||
|
|
||||||
|
|||||||
@@ -868,6 +868,14 @@ static void json_add_utxo(struct json_stream *response,
|
|||||||
json_add_amount_sat_compat(response, utxo->amount,
|
json_add_amount_sat_compat(response, utxo->amount,
|
||||||
"value", "amount_msat");
|
"value", "amount_msat");
|
||||||
|
|
||||||
|
if (utxo->is_p2sh) {
|
||||||
|
struct pubkey key;
|
||||||
|
bip32_pubkey(wallet->bip32_base, &key, utxo->keyindex);
|
||||||
|
|
||||||
|
json_add_hex_talarr(response, "redeemscript",
|
||||||
|
bitcoin_redeem_p2sh_p2wpkh(tmpctx, &key));
|
||||||
|
}
|
||||||
|
|
||||||
json_add_hex_talarr(response, "scriptpubkey", utxo->scriptPubkey);
|
json_add_hex_talarr(response, "scriptpubkey", utxo->scriptPubkey);
|
||||||
out = encode_scriptpubkey_to_addr(tmpctx, chainparams,
|
out = encode_scriptpubkey_to_addr(tmpctx, chainparams,
|
||||||
utxo->scriptPubkey);
|
utxo->scriptPubkey);
|
||||||
|
|||||||
Reference in New Issue
Block a user