|
|
@ -3,6 +3,7 @@
|
|
|
|
// Distributed under the MIT software license, see the accompanying
|
|
|
|
// Distributed under the MIT software license, see the accompanying
|
|
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <base58.h>
|
|
|
|
#include <chain.h>
|
|
|
|
#include <chain.h>
|
|
|
|
#include <coins.h>
|
|
|
|
#include <coins.h>
|
|
|
|
#include <consensus/amount.h>
|
|
|
|
#include <consensus/amount.h>
|
|
|
@ -1075,6 +1076,15 @@ static RPCHelpMan decodepsbt()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
{RPCResult::Type::ELISION, "", "The layout is the same as the output of decoderawtransaction."},
|
|
|
|
{RPCResult::Type::ELISION, "", "The layout is the same as the output of decoderawtransaction."},
|
|
|
|
}},
|
|
|
|
}},
|
|
|
|
|
|
|
|
{RPCResult::Type::ARR, "global_xpubs", "",
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
{RPCResult::Type::OBJ, "", "",
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
{RPCResult::Type::STR, "xpub", "The extended public key this path corresponds to"},
|
|
|
|
|
|
|
|
{RPCResult::Type::STR_HEX, "master_fingerprint", "The fingerprint of the master key"},
|
|
|
|
|
|
|
|
{RPCResult::Type::STR, "path", "The path"},
|
|
|
|
|
|
|
|
}},
|
|
|
|
|
|
|
|
}},
|
|
|
|
{RPCResult::Type::NUM, "psbt_version", "The PSBT version number. Not to be confused with the unsigned transaction version"},
|
|
|
|
{RPCResult::Type::NUM, "psbt_version", "The PSBT version number. Not to be confused with the unsigned transaction version"},
|
|
|
|
{RPCResult::Type::ARR, "proprietary", "The global proprietary map",
|
|
|
|
{RPCResult::Type::ARR, "proprietary", "The global proprietary map",
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -1225,6 +1235,23 @@ static RPCHelpMan decodepsbt()
|
|
|
|
TxToUniv(CTransaction(*psbtx.tx), uint256(), tx_univ, false);
|
|
|
|
TxToUniv(CTransaction(*psbtx.tx), uint256(), tx_univ, false);
|
|
|
|
result.pushKV("tx", tx_univ);
|
|
|
|
result.pushKV("tx", tx_univ);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Add the global xpubs
|
|
|
|
|
|
|
|
UniValue global_xpubs(UniValue::VARR);
|
|
|
|
|
|
|
|
for (std::pair<KeyOriginInfo, std::set<CExtPubKey>> xpub_pair : psbtx.m_xpubs) {
|
|
|
|
|
|
|
|
for (auto& xpub : xpub_pair.second) {
|
|
|
|
|
|
|
|
std::vector<unsigned char> ser_xpub;
|
|
|
|
|
|
|
|
ser_xpub.assign(BIP32_EXTKEY_WITH_VERSION_SIZE, 0);
|
|
|
|
|
|
|
|
xpub.EncodeWithVersion(ser_xpub.data());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UniValue keypath(UniValue::VOBJ);
|
|
|
|
|
|
|
|
keypath.pushKV("xpub", EncodeBase58Check(ser_xpub));
|
|
|
|
|
|
|
|
keypath.pushKV("master_fingerprint", HexStr(Span<unsigned char>(xpub_pair.first.fingerprint, xpub_pair.first.fingerprint + 4)));
|
|
|
|
|
|
|
|
keypath.pushKV("path", WriteHDKeypath(xpub_pair.first.path));
|
|
|
|
|
|
|
|
global_xpubs.push_back(keypath);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
result.pushKV("global_xpubs", global_xpubs);
|
|
|
|
|
|
|
|
|
|
|
|
// PSBT version
|
|
|
|
// PSBT version
|
|
|
|
result.pushKV("psbt_version", static_cast<uint64_t>(psbtx.GetVersion()));
|
|
|
|
result.pushKV("psbt_version", static_cast<uint64_t>(psbtx.GetVersion()));
|
|
|
|
|
|
|
|
|
|
|
|