mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-23 05:59:48 +01:00
wallet rpc: return final tx hex from walletprocesspsbt if complete
This commit is contained in:
@@ -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;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user