aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthew Zipkin <pinheadmz@gmail.com>2023-09-05 08:45:07 -0400
committerMatthew Zipkin <pinheadmz@gmail.com>2023-09-05 09:14:32 -0400
commite3d484b603abff69c6ebfca5cfb78cf82743d090 (patch)
tree6199abda237f58f1260184eae47d80cc476bdc38 /src
parentecab855838fa4de4c6d8c11e69037477d6047790 (diff)
downloadbitcoin-e3d484b603abff69c6ebfca5cfb78cf82743d090.tar.xz
wallet rpc: return final tx hex from walletprocesspsbt if complete
Diffstat (limited to 'src')
-rw-r--r--src/wallet/rpc/spend.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/wallet/rpc/spend.cpp b/src/wallet/rpc/spend.cpp
index 0c2be26ddf..c4206e9897 100644
--- a/src/wallet/rpc/spend.cpp
+++ b/src/wallet/rpc/spend.cpp
@@ -1566,6 +1566,7 @@ RPCHelpMan walletprocesspsbt()
{
{RPCResult::Type::STR, "psbt", "The base64-encoded partially signed transaction"},
{RPCResult::Type::BOOL, "complete", "If the transaction has a complete set of signatures"},
+ {RPCResult::Type::STR_HEX, "hex", /*optional=*/true, "The hex-encoded network transaction if complete"},
}
},
RPCExamples{
@@ -1609,6 +1610,14 @@ RPCHelpMan walletprocesspsbt()
ssTx << psbtx;
result.pushKV("psbt", EncodeBase64(ssTx.str()));
result.pushKV("complete", complete);
+ if (complete) {
+ CMutableTransaction mtx;
+ // Returns true if complete, which we already think it is.
+ CHECK_NONFATAL(FinalizeAndExtractPSBT(psbtx, mtx));
+ CDataStream ssTx_final(SER_NETWORK, PROTOCOL_VERSION);
+ ssTx_final << mtx;
+ result.pushKV("hex", HexStr(ssTx_final));
+ }
return result;
},