diff options
author | ismaelsadeeq <ask4ismailsadiq@gmail.com> | 2023-09-15 16:46:09 +0100 |
---|---|---|
committer | ismaelsadeeq <ask4ismailsadiq@gmail.com> | 2023-09-15 16:46:09 +0100 |
commit | c405207a18fdee75a4dea470bb0d13e59e15ce45 (patch) | |
tree | 6eb8a68a51c9c5ac7bbeb7e2d7b42319a48c0f05 /src/rpc | |
parent | f1a9fd627b1a669c4dfab797da42825230708f2a (diff) |
rpc: `descriptorprocesspsbt` return hex encoded tx
If processed psbt is complete return hex encoded network
transaction in the output.
Diffstat (limited to 'src/rpc')
-rw-r--r-- | src/rpc/rawtransaction.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp index fa5dd281a1..31ca126862 100644 --- a/src/rpc/rawtransaction.cpp +++ b/src/rpc/rawtransaction.cpp @@ -1949,6 +1949,7 @@ RPCHelpMan descriptorprocesspsbt() { {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{ @@ -1989,7 +1990,14 @@ RPCHelpMan descriptorprocesspsbt() result.pushKV("psbt", EncodeBase64(ssTx)); result.pushKV("complete", complete); - + if (complete) { + CMutableTransaction mtx; + PartiallySignedTransaction psbtx_copy = psbtx; + CHECK_NONFATAL(FinalizeAndExtractPSBT(psbtx_copy, mtx)); + CDataStream ssTx_final(SER_NETWORK, PROTOCOL_VERSION); + ssTx_final << mtx; + result.pushKV("hex", HexStr(ssTx_final)); + } return result; }, }; |