mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-10 10:52:31 -05:00
scantxoutset: support legacy P2PK script type
This commit is contained in:
parent
892de1dfea
commit
94d73d32ab
1 changed files with 8 additions and 3 deletions
|
@ -2036,7 +2036,7 @@ UniValue scantxoutset(const JSONRPCRequest& request)
|
||||||
" { \"pubkey\" : (object, optional) Public key\n"
|
" { \"pubkey\" : (object, optional) Public key\n"
|
||||||
" {\n"
|
" {\n"
|
||||||
" \"pubkey\" : \"<pubkey\">, (string, required) HEX encoded public key\n"
|
" \"pubkey\" : \"<pubkey\">, (string, required) HEX encoded public key\n"
|
||||||
" \"script_types\" : [ ... ], (array, optional) Array of script-types to derive from the pubkey (possible values: \"P2PKH\", \"P2SH-P2WPKH\", \"P2WPKH\")\n"
|
" \"script_types\" : [ ... ], (array, optional) Array of script-types to derive from the pubkey (possible values: \"P2PK\", \"P2PKH\", \"P2SH-P2WPKH\", \"P2WPKH\")\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
" },\n"
|
" },\n"
|
||||||
" ]\n"
|
" ]\n"
|
||||||
|
@ -2142,8 +2142,13 @@ UniValue scantxoutset(const JSONRPCRequest& request)
|
||||||
for (const UniValue& script_type_uni : script_types_uni.get_array().getValues()) {
|
for (const UniValue& script_type_uni : script_types_uni.get_array().getValues()) {
|
||||||
OutputScriptType script_type = GetOutputScriptTypeFromString(script_type_uni.get_str());
|
OutputScriptType script_type = GetOutputScriptTypeFromString(script_type_uni.get_str());
|
||||||
if (script_type == OutputScriptType::UNKNOWN) throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid script type");
|
if (script_type == OutputScriptType::UNKNOWN) throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid script type");
|
||||||
|
CScript script;
|
||||||
CScript script = GetScriptForDestination(GetDestinationForKey(pubkey, script_type));
|
if (script_type == OutputScriptType::P2PK) {
|
||||||
|
// support legacy P2PK scripts
|
||||||
|
script << ToByteVector(pubkey) << OP_CHECKSIG;
|
||||||
|
} else {
|
||||||
|
script = GetScriptForDestination(GetDestinationForKey(pubkey, script_type));
|
||||||
|
}
|
||||||
assert(!script.empty());
|
assert(!script.empty());
|
||||||
needles.insert(script);
|
needles.insert(script);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue