mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-10 22:18:54 +01:00
rpc, refactor: Add decodepsbt_outputs
This change eliminates memory usage spike when compiling with Visual Studio 2022 (at least in Cirrus CI environment). Easy to review using `git diff --color-moved-ws=allow-indentation-change --color-moved=dimmed-zebra`
This commit is contained in:
@@ -807,6 +807,73 @@ const RPCResult decodepsbt_inputs{
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const RPCResult decodepsbt_outputs{
|
||||||
|
RPCResult::Type::ARR, "outputs", "",
|
||||||
|
{
|
||||||
|
{RPCResult::Type::OBJ, "", "",
|
||||||
|
{
|
||||||
|
{RPCResult::Type::OBJ, "redeem_script", /*optional=*/true, "",
|
||||||
|
{
|
||||||
|
{RPCResult::Type::STR, "asm", "The asm"},
|
||||||
|
{RPCResult::Type::STR_HEX, "hex", "The hex"},
|
||||||
|
{RPCResult::Type::STR, "type", "The type, eg 'pubkeyhash'"},
|
||||||
|
}},
|
||||||
|
{RPCResult::Type::OBJ, "witness_script", /*optional=*/true, "",
|
||||||
|
{
|
||||||
|
{RPCResult::Type::STR, "asm", "The asm"},
|
||||||
|
{RPCResult::Type::STR_HEX, "hex", "The hex"},
|
||||||
|
{RPCResult::Type::STR, "type", "The type, eg 'pubkeyhash'"},
|
||||||
|
}},
|
||||||
|
{RPCResult::Type::ARR, "bip32_derivs", /*optional=*/true, "",
|
||||||
|
{
|
||||||
|
{RPCResult::Type::OBJ, "", "",
|
||||||
|
{
|
||||||
|
{RPCResult::Type::STR, "pubkey", "The public key this path corresponds to"},
|
||||||
|
{RPCResult::Type::STR, "master_fingerprint", "The fingerprint of the master key"},
|
||||||
|
{RPCResult::Type::STR, "path", "The path"},
|
||||||
|
}},
|
||||||
|
}},
|
||||||
|
{RPCResult::Type::STR_HEX, "taproot_internal_key", /*optional=*/ true, "The hex-encoded Taproot x-only internal key"},
|
||||||
|
{RPCResult::Type::ARR, "taproot_tree", /*optional=*/ true, "The tuples that make up the Taproot tree, in depth first search order",
|
||||||
|
{
|
||||||
|
{RPCResult::Type::OBJ, "tuple", /*optional=*/ true, "A single leaf script in the taproot tree",
|
||||||
|
{
|
||||||
|
{RPCResult::Type::NUM, "depth", "The depth of this element in the tree"},
|
||||||
|
{RPCResult::Type::NUM, "leaf_ver", "The version of this leaf"},
|
||||||
|
{RPCResult::Type::STR, "script", "The hex-encoded script itself"},
|
||||||
|
}},
|
||||||
|
}},
|
||||||
|
{RPCResult::Type::ARR, "taproot_bip32_derivs", /*optional=*/ true, "",
|
||||||
|
{
|
||||||
|
{RPCResult::Type::OBJ, "", "",
|
||||||
|
{
|
||||||
|
{RPCResult::Type::STR, "pubkey", "The x-only public key this path corresponds to"},
|
||||||
|
{RPCResult::Type::STR, "master_fingerprint", "The fingerprint of the master key"},
|
||||||
|
{RPCResult::Type::STR, "path", "The path"},
|
||||||
|
{RPCResult::Type::ARR, "leaf_hashes", "The hashes of the leaves this pubkey appears in",
|
||||||
|
{
|
||||||
|
{RPCResult::Type::STR_HEX, "hash", "The hash of a leaf this pubkey appears in"},
|
||||||
|
}},
|
||||||
|
}},
|
||||||
|
}},
|
||||||
|
{RPCResult::Type::OBJ_DYN, "unknown", /*optional=*/true, "The unknown output fields",
|
||||||
|
{
|
||||||
|
{RPCResult::Type::STR_HEX, "key", "(key-value pair) An unknown key-value pair"},
|
||||||
|
}},
|
||||||
|
{RPCResult::Type::ARR, "proprietary", /*optional=*/true, "The output proprietary map",
|
||||||
|
{
|
||||||
|
{RPCResult::Type::OBJ, "", "",
|
||||||
|
{
|
||||||
|
{RPCResult::Type::STR_HEX, "identifier", "The hex string for the proprietary identifier"},
|
||||||
|
{RPCResult::Type::NUM, "subtype", "The number for the subtype"},
|
||||||
|
{RPCResult::Type::STR_HEX, "key", "The hex for the key"},
|
||||||
|
{RPCResult::Type::STR_HEX, "value", "The hex for the value"},
|
||||||
|
}},
|
||||||
|
}},
|
||||||
|
}},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
static RPCHelpMan decodepsbt()
|
static RPCHelpMan decodepsbt()
|
||||||
{
|
{
|
||||||
return RPCHelpMan{
|
return RPCHelpMan{
|
||||||
@@ -847,70 +914,7 @@ static RPCHelpMan decodepsbt()
|
|||||||
{RPCResult::Type::STR_HEX, "key", "(key-value pair) An unknown key-value pair"},
|
{RPCResult::Type::STR_HEX, "key", "(key-value pair) An unknown key-value pair"},
|
||||||
}},
|
}},
|
||||||
decodepsbt_inputs,
|
decodepsbt_inputs,
|
||||||
{RPCResult::Type::ARR, "outputs", "",
|
decodepsbt_outputs,
|
||||||
{
|
|
||||||
{RPCResult::Type::OBJ, "", "",
|
|
||||||
{
|
|
||||||
{RPCResult::Type::OBJ, "redeem_script", /*optional=*/true, "",
|
|
||||||
{
|
|
||||||
{RPCResult::Type::STR, "asm", "The asm"},
|
|
||||||
{RPCResult::Type::STR_HEX, "hex", "The hex"},
|
|
||||||
{RPCResult::Type::STR, "type", "The type, eg 'pubkeyhash'"},
|
|
||||||
}},
|
|
||||||
{RPCResult::Type::OBJ, "witness_script", /*optional=*/true, "",
|
|
||||||
{
|
|
||||||
{RPCResult::Type::STR, "asm", "The asm"},
|
|
||||||
{RPCResult::Type::STR_HEX, "hex", "The hex"},
|
|
||||||
{RPCResult::Type::STR, "type", "The type, eg 'pubkeyhash'"},
|
|
||||||
}},
|
|
||||||
{RPCResult::Type::ARR, "bip32_derivs", /*optional=*/true, "",
|
|
||||||
{
|
|
||||||
{RPCResult::Type::OBJ, "", "",
|
|
||||||
{
|
|
||||||
{RPCResult::Type::STR, "pubkey", "The public key this path corresponds to"},
|
|
||||||
{RPCResult::Type::STR, "master_fingerprint", "The fingerprint of the master key"},
|
|
||||||
{RPCResult::Type::STR, "path", "The path"},
|
|
||||||
}},
|
|
||||||
}},
|
|
||||||
{RPCResult::Type::STR_HEX, "taproot_internal_key", /*optional=*/ true, "The hex-encoded Taproot x-only internal key"},
|
|
||||||
{RPCResult::Type::ARR, "taproot_tree", /*optional=*/ true, "The tuples that make up the Taproot tree, in depth first search order",
|
|
||||||
{
|
|
||||||
{RPCResult::Type::OBJ, "tuple", /*optional=*/ true, "A single leaf script in the taproot tree",
|
|
||||||
{
|
|
||||||
{RPCResult::Type::NUM, "depth", "The depth of this element in the tree"},
|
|
||||||
{RPCResult::Type::NUM, "leaf_ver", "The version of this leaf"},
|
|
||||||
{RPCResult::Type::STR, "script", "The hex-encoded script itself"},
|
|
||||||
}},
|
|
||||||
}},
|
|
||||||
{RPCResult::Type::ARR, "taproot_bip32_derivs", /*optional=*/ true, "",
|
|
||||||
{
|
|
||||||
{RPCResult::Type::OBJ, "", "",
|
|
||||||
{
|
|
||||||
{RPCResult::Type::STR, "pubkey", "The x-only public key this path corresponds to"},
|
|
||||||
{RPCResult::Type::STR, "master_fingerprint", "The fingerprint of the master key"},
|
|
||||||
{RPCResult::Type::STR, "path", "The path"},
|
|
||||||
{RPCResult::Type::ARR, "leaf_hashes", "The hashes of the leaves this pubkey appears in",
|
|
||||||
{
|
|
||||||
{RPCResult::Type::STR_HEX, "hash", "The hash of a leaf this pubkey appears in"},
|
|
||||||
}},
|
|
||||||
}},
|
|
||||||
}},
|
|
||||||
{RPCResult::Type::OBJ_DYN, "unknown", /*optional=*/true, "The unknown output fields",
|
|
||||||
{
|
|
||||||
{RPCResult::Type::STR_HEX, "key", "(key-value pair) An unknown key-value pair"},
|
|
||||||
}},
|
|
||||||
{RPCResult::Type::ARR, "proprietary", /*optional=*/true, "The output proprietary map",
|
|
||||||
{
|
|
||||||
{RPCResult::Type::OBJ, "", "",
|
|
||||||
{
|
|
||||||
{RPCResult::Type::STR_HEX, "identifier", "The hex string for the proprietary identifier"},
|
|
||||||
{RPCResult::Type::NUM, "subtype", "The number for the subtype"},
|
|
||||||
{RPCResult::Type::STR_HEX, "key", "The hex for the key"},
|
|
||||||
{RPCResult::Type::STR_HEX, "value", "The hex for the value"},
|
|
||||||
}},
|
|
||||||
}},
|
|
||||||
}},
|
|
||||||
}},
|
|
||||||
{RPCResult::Type::STR_AMOUNT, "fee", /*optional=*/true, "The transaction fee paid if all UTXOs slots in the PSBT have been filled."},
|
{RPCResult::Type::STR_AMOUNT, "fee", /*optional=*/true, "The transaction fee paid if all UTXOs slots in the PSBT have been filled."},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user