mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-26 15:36:19 +01:00
Merge bitcoin/bitcoin#28492: RPC: descriptorprocesspsbt returns hex encoded tx if complete
a99e9e655adoc: add release note (ismaelsadeeq)2b4edf889atest: check `descriptorprocesspsbt` return hex encoded tx (ismaelsadeeq)c405207a18rpc: `descriptorprocesspsbt` return hex encoded tx (ismaelsadeeq) Pull request description: Coming from [#28414 comment](https://github.com/bitcoin/bitcoin/pull/28414#pullrequestreview-1618684391) Same thing also for `descriptorprocesspsbt`. Before this PR `descriptorprocesspsbt` returns a boolean `complete` which indicates that the psbt is final, users then have to call `finalizepsbt` to get the hex encoded network transaction. In this PR if the psbt is complete the return object also has the hex encoded network transaction ready for broadcast with `sendrawtransaction`. This save users calling `finalizepsbt` with the descriptor, if it is already complete. ACKs for top commit: achow101: ACKa99e9e655apinheadmz: ACKa99e9e655aishaanam: ACKa99e9e655aTree-SHA512: c3f1b1391d4df05216c463127cd593f8703840430a99febb54890bc66fadabf9d9530860605f347ec54c1694019173247a0e7a9eb879d3cbb420f9e8d9839b75
This commit is contained in:
@@ -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;
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user