mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-06 14:19:59 -05:00
rpc, refactor: Add decodepsbt_inputs
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:
parent
01d95a3964
commit
0c432cbbfa
1 changed files with 128 additions and 124 deletions
|
@ -680,6 +680,133 @@ static RPCHelpMan signrawtransactionwithkey()
|
|||
};
|
||||
}
|
||||
|
||||
const RPCResult decodepsbt_inputs{
|
||||
RPCResult::Type::ARR, "inputs", "",
|
||||
{
|
||||
{RPCResult::Type::OBJ, "", "",
|
||||
{
|
||||
{RPCResult::Type::OBJ, "non_witness_utxo", /*optional=*/true, "Decoded network transaction for non-witness UTXOs",
|
||||
{
|
||||
{RPCResult::Type::ELISION, "",""},
|
||||
}},
|
||||
{RPCResult::Type::OBJ, "witness_utxo", /*optional=*/true, "Transaction output for witness UTXOs",
|
||||
{
|
||||
{RPCResult::Type::NUM, "amount", "The value in " + CURRENCY_UNIT},
|
||||
{RPCResult::Type::OBJ, "scriptPubKey", "",
|
||||
{
|
||||
{RPCResult::Type::STR, "asm", "The asm"},
|
||||
{RPCResult::Type::STR, "desc", "Inferred descriptor for the output"},
|
||||
{RPCResult::Type::STR_HEX, "hex", "The hex"},
|
||||
{RPCResult::Type::STR, "type", "The type, eg 'pubkeyhash'"},
|
||||
{RPCResult::Type::STR, "address", /*optional=*/true, "The Bitcoin address (only if a well-defined address exists)"},
|
||||
}},
|
||||
}},
|
||||
{RPCResult::Type::OBJ_DYN, "partial_signatures", /*optional=*/true, "",
|
||||
{
|
||||
{RPCResult::Type::STR, "pubkey", "The public key and signature that corresponds to it."},
|
||||
}},
|
||||
{RPCResult::Type::STR, "sighash", /*optional=*/true, "The sighash type to be used"},
|
||||
{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 with the derivation path as the value."},
|
||||
{RPCResult::Type::STR, "master_fingerprint", "The fingerprint of the master key"},
|
||||
{RPCResult::Type::STR, "path", "The path"},
|
||||
}},
|
||||
}},
|
||||
{RPCResult::Type::OBJ, "final_scriptSig", /*optional=*/true, "",
|
||||
{
|
||||
{RPCResult::Type::STR, "asm", "The asm"},
|
||||
{RPCResult::Type::STR, "hex", "The hex"},
|
||||
}},
|
||||
{RPCResult::Type::ARR, "final_scriptwitness", /*optional=*/true, "",
|
||||
{
|
||||
{RPCResult::Type::STR_HEX, "", "hex-encoded witness data (if any)"},
|
||||
}},
|
||||
{RPCResult::Type::OBJ_DYN, "ripemd160_preimages", /*optional=*/ true, "",
|
||||
{
|
||||
{RPCResult::Type::STR, "hash", "The hash and preimage that corresponds to it."},
|
||||
}},
|
||||
{RPCResult::Type::OBJ_DYN, "sha256_preimages", /*optional=*/ true, "",
|
||||
{
|
||||
{RPCResult::Type::STR, "hash", "The hash and preimage that corresponds to it."},
|
||||
}},
|
||||
{RPCResult::Type::OBJ_DYN, "hash160_preimages", /*optional=*/ true, "",
|
||||
{
|
||||
{RPCResult::Type::STR, "hash", "The hash and preimage that corresponds to it."},
|
||||
}},
|
||||
{RPCResult::Type::OBJ_DYN, "hash256_preimages", /*optional=*/ true, "",
|
||||
{
|
||||
{RPCResult::Type::STR, "hash", "The hash and preimage that corresponds to it."},
|
||||
}},
|
||||
{RPCResult::Type::STR_HEX, "taproot_key_path_sig", /*optional=*/ true, "hex-encoded signature for the Taproot key path spend"},
|
||||
{RPCResult::Type::ARR, "taproot_script_path_sigs", /*optional=*/ true, "",
|
||||
{
|
||||
{RPCResult::Type::OBJ, "signature", /*optional=*/ true, "The signature for the pubkey and leaf hash combination",
|
||||
{
|
||||
{RPCResult::Type::STR, "pubkey", "The x-only pubkey for this signature"},
|
||||
{RPCResult::Type::STR, "leaf_hash", "The leaf hash for this signature"},
|
||||
{RPCResult::Type::STR, "sig", "The signature itself"},
|
||||
}},
|
||||
}},
|
||||
{RPCResult::Type::ARR, "taproot_scripts", /*optional=*/ true, "",
|
||||
{
|
||||
{RPCResult::Type::OBJ, "", "",
|
||||
{
|
||||
{RPCResult::Type::STR_HEX, "script", "A leaf script"},
|
||||
{RPCResult::Type::NUM, "leaf_ver", "The version number for the leaf script"},
|
||||
{RPCResult::Type::ARR, "control_blocks", "The control blocks for this script",
|
||||
{
|
||||
{RPCResult::Type::STR_HEX, "control_block", "A hex-encoded control block for this script"},
|
||||
}},
|
||||
}},
|
||||
}},
|
||||
{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::STR_HEX, "taproot_internal_key", /*optional=*/ true, "The hex-encoded Taproot x-only internal key"},
|
||||
{RPCResult::Type::STR_HEX, "taproot_merkle_root", /*optional=*/ true, "The hex-encoded Taproot merkle root"},
|
||||
{RPCResult::Type::OBJ_DYN, "unknown", /*optional=*/ true, "The unknown input fields",
|
||||
{
|
||||
{RPCResult::Type::STR_HEX, "key", "(key-value pair) An unknown key-value pair"},
|
||||
}},
|
||||
{RPCResult::Type::ARR, "proprietary", /*optional=*/true, "The input 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()
|
||||
{
|
||||
return RPCHelpMan{
|
||||
|
@ -719,130 +846,7 @@ static RPCHelpMan decodepsbt()
|
|||
{
|
||||
{RPCResult::Type::STR_HEX, "key", "(key-value pair) An unknown key-value pair"},
|
||||
}},
|
||||
{RPCResult::Type::ARR, "inputs", "",
|
||||
{
|
||||
{RPCResult::Type::OBJ, "", "",
|
||||
{
|
||||
{RPCResult::Type::OBJ, "non_witness_utxo", /*optional=*/true, "Decoded network transaction for non-witness UTXOs",
|
||||
{
|
||||
{RPCResult::Type::ELISION, "",""},
|
||||
}},
|
||||
{RPCResult::Type::OBJ, "witness_utxo", /*optional=*/true, "Transaction output for witness UTXOs",
|
||||
{
|
||||
{RPCResult::Type::NUM, "amount", "The value in " + CURRENCY_UNIT},
|
||||
{RPCResult::Type::OBJ, "scriptPubKey", "",
|
||||
{
|
||||
{RPCResult::Type::STR, "asm", "The asm"},
|
||||
{RPCResult::Type::STR, "desc", "Inferred descriptor for the output"},
|
||||
{RPCResult::Type::STR_HEX, "hex", "The hex"},
|
||||
{RPCResult::Type::STR, "type", "The type, eg 'pubkeyhash'"},
|
||||
{RPCResult::Type::STR, "address", /*optional=*/true, "The Bitcoin address (only if a well-defined address exists)"},
|
||||
}},
|
||||
}},
|
||||
{RPCResult::Type::OBJ_DYN, "partial_signatures", /*optional=*/true, "",
|
||||
{
|
||||
{RPCResult::Type::STR, "pubkey", "The public key and signature that corresponds to it."},
|
||||
}},
|
||||
{RPCResult::Type::STR, "sighash", /*optional=*/true, "The sighash type to be used"},
|
||||
{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 with the derivation path as the value."},
|
||||
{RPCResult::Type::STR, "master_fingerprint", "The fingerprint of the master key"},
|
||||
{RPCResult::Type::STR, "path", "The path"},
|
||||
}},
|
||||
}},
|
||||
{RPCResult::Type::OBJ, "final_scriptSig", /*optional=*/true, "",
|
||||
{
|
||||
{RPCResult::Type::STR, "asm", "The asm"},
|
||||
{RPCResult::Type::STR, "hex", "The hex"},
|
||||
}},
|
||||
{RPCResult::Type::ARR, "final_scriptwitness", /*optional=*/true, "",
|
||||
{
|
||||
{RPCResult::Type::STR_HEX, "", "hex-encoded witness data (if any)"},
|
||||
}},
|
||||
{RPCResult::Type::OBJ_DYN, "ripemd160_preimages", /*optional=*/ true, "",
|
||||
{
|
||||
{RPCResult::Type::STR, "hash", "The hash and preimage that corresponds to it."},
|
||||
}},
|
||||
{RPCResult::Type::OBJ_DYN, "sha256_preimages", /*optional=*/ true, "",
|
||||
{
|
||||
{RPCResult::Type::STR, "hash", "The hash and preimage that corresponds to it."},
|
||||
}},
|
||||
{RPCResult::Type::OBJ_DYN, "hash160_preimages", /*optional=*/ true, "",
|
||||
{
|
||||
{RPCResult::Type::STR, "hash", "The hash and preimage that corresponds to it."},
|
||||
}},
|
||||
{RPCResult::Type::OBJ_DYN, "hash256_preimages", /*optional=*/ true, "",
|
||||
{
|
||||
{RPCResult::Type::STR, "hash", "The hash and preimage that corresponds to it."},
|
||||
}},
|
||||
{RPCResult::Type::STR_HEX, "taproot_key_path_sig", /*optional=*/ true, "hex-encoded signature for the Taproot key path spend"},
|
||||
{RPCResult::Type::ARR, "taproot_script_path_sigs", /*optional=*/ true, "",
|
||||
{
|
||||
{RPCResult::Type::OBJ, "signature", /*optional=*/ true, "The signature for the pubkey and leaf hash combination",
|
||||
{
|
||||
{RPCResult::Type::STR, "pubkey", "The x-only pubkey for this signature"},
|
||||
{RPCResult::Type::STR, "leaf_hash", "The leaf hash for this signature"},
|
||||
{RPCResult::Type::STR, "sig", "The signature itself"},
|
||||
}},
|
||||
}},
|
||||
{RPCResult::Type::ARR, "taproot_scripts", /*optional=*/ true, "",
|
||||
{
|
||||
{RPCResult::Type::OBJ, "", "",
|
||||
{
|
||||
{RPCResult::Type::STR_HEX, "script", "A leaf script"},
|
||||
{RPCResult::Type::NUM, "leaf_ver", "The version number for the leaf script"},
|
||||
{RPCResult::Type::ARR, "control_blocks", "The control blocks for this script",
|
||||
{
|
||||
{RPCResult::Type::STR_HEX, "control_block", "A hex-encoded control block for this script"},
|
||||
}},
|
||||
}},
|
||||
}},
|
||||
{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::STR_HEX, "taproot_internal_key", /*optional=*/ true, "The hex-encoded Taproot x-only internal key"},
|
||||
{RPCResult::Type::STR_HEX, "taproot_merkle_root", /*optional=*/ true, "The hex-encoded Taproot merkle root"},
|
||||
{RPCResult::Type::OBJ_DYN, "unknown", /*optional=*/ true, "The unknown input fields",
|
||||
{
|
||||
{RPCResult::Type::STR_HEX, "key", "(key-value pair) An unknown key-value pair"},
|
||||
}},
|
||||
{RPCResult::Type::ARR, "proprietary", /*optional=*/true, "The input 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"},
|
||||
}},
|
||||
}},
|
||||
}},
|
||||
}},
|
||||
decodepsbt_inputs,
|
||||
{RPCResult::Type::ARR, "outputs", "",
|
||||
{
|
||||
{RPCResult::Type::OBJ, "", "",
|
||||
|
|
Loading…
Add table
Reference in a new issue