mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-10 10:52:31 -05:00
rpc: descriptorprocesspsbt
return hex encoded tx
If processed psbt is complete return hex encoded network transaction in the output.
This commit is contained in:
parent
f1a9fd627b
commit
c405207a18
1 changed files with 9 additions and 1 deletions
|
@ -1949,6 +1949,7 @@ RPCHelpMan descriptorprocesspsbt()
|
||||||
{
|
{
|
||||||
{RPCResult::Type::STR, "psbt", "The base64-encoded partially signed transaction"},
|
{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::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{
|
RPCExamples{
|
||||||
|
@ -1989,7 +1990,14 @@ RPCHelpMan descriptorprocesspsbt()
|
||||||
|
|
||||||
result.pushKV("psbt", EncodeBase64(ssTx));
|
result.pushKV("psbt", EncodeBase64(ssTx));
|
||||||
result.pushKV("complete", complete);
|
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;
|
return result;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue