aboutsummaryrefslogtreecommitdiff
path: root/src/rpc
diff options
context:
space:
mode:
authorJonas Schnelli <dev@jonasschnelli.ch>2018-06-13 16:00:30 +0200
committerJonas Schnelli <dev@jonasschnelli.ch>2018-07-15 21:18:10 +0100
commit94d73d32abe927e74271a7b3eac7ba56658a535e (patch)
treeefbaeb8b88c6b20e42e6fa8a4f6eabdd086e5773 /src/rpc
parent892de1dfea283a5d6ac18b8c74b57f61a920c762 (diff)
downloadbitcoin-94d73d32abe927e74271a7b3eac7ba56658a535e.tar.xz
scantxoutset: support legacy P2PK script type
Diffstat (limited to 'src/rpc')
-rw-r--r--src/rpc/blockchain.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp
index 8fec32f05e..a339bd10f0 100644
--- a/src/rpc/blockchain.cpp
+++ b/src/rpc/blockchain.cpp
@@ -2036,7 +2036,7 @@ UniValue scantxoutset(const JSONRPCRequest& request)
" { \"pubkey\" : (object, optional) Public key\n"
" {\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"
@@ -2142,8 +2142,13 @@ UniValue scantxoutset(const JSONRPCRequest& request)
for (const UniValue& script_type_uni : script_types_uni.get_array().getValues()) {
OutputScriptType script_type = GetOutputScriptTypeFromString(script_type_uni.get_str());
if (script_type == OutputScriptType::UNKNOWN) throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid script type");
-
- CScript script = GetScriptForDestination(GetDestinationForKey(pubkey, script_type));
+ CScript script;
+ if (script_type == OutputScriptType::P2PK) {
+ // support legacy P2PK scripts
+ script << ToByteVector(pubkey) << OP_CHECKSIG;
+ } else {
+ script = GetScriptForDestination(GetDestinationForKey(pubkey, script_type));
+ }
assert(!script.empty());
needles.insert(script);
}