diff --git a/src/chainparamsbase.cpp b/src/chainparamsbase.cpp index d799d309ac..c5b17d1020 100644 --- a/src/chainparamsbase.cpp +++ b/src/chainparamsbase.cpp @@ -38,8 +38,8 @@ void SetupChainParamsBaseOptions() gArgs.AddArg("-anyonecanspendaremine", "Consider ANYONECANSPEND outputs as yours.", false, OptionsCategory::CHAINPARAMS); gArgs.AddArg("-fedpegscript", "The script for the federated peg.", false, OptionsCategory::CHAINPARAMS); - gArgs.AddArg("-parentpubkeyprefix", strprintf("The byte prefix, in decimal, of the parent chain's base58 pubkey address. (default: %d)", 111)); - gArgs.AddArg("-parentscriptprefix", strprintf("The byte prefix, in decimal, of the parent chain's base58 script address. (default: %d)", 196)); + gArgs.AddArg("-parentpubkeyprefix", strprintf("The byte prefix, in decimal, of the parent chain's base58 pubkey address. (default: %d)", 111), false, OptionsCategory::ELEMENTS); + gArgs.AddArg("-parentscriptprefix", strprintf("The byte prefix, in decimal, of the parent chain's base58 script address. (default: %d)", 196), false, OptionsCategory::ELEMENTS); gArgs.AddArg("-parent_bech32_hrp", strprintf("The human-readable part of the parent chain's bech32 encoding. (default: %s)", "bc"), false, OptionsCategory::ELEMENTS); } diff --git a/src/key_io.cpp b/src/key_io.cpp index 8caa6d60a0..940e2d7591 100644 --- a/src/key_io.cpp +++ b/src/key_io.cpp @@ -73,6 +73,7 @@ class DestinationEncoder : public boost::static_visitor } std::string operator()(const CNoDestination& no) const { return {}; } + std::string operator()(const NullData& nd) const { return {}; } }; CTxDestination DecodeDestination(const std::string& str, const CChainParams& params, const bool for_parent) @@ -89,7 +90,6 @@ CTxDestination DecodeDestination(const std::string& str, const CChainParams& par std::copy(data.begin() + pubkey_prefix.size(), data.end(), hash.begin()); return CKeyID(hash); } - { // Script-hash-addresses have version 5 (or 196 testnet). // The data vector contains RIPEMD160(SHA256(cscript)), where cscript is the serialized redemption script. CChainParams::Base58Type type_sh = for_parent ? CChainParams::PARENT_SCRIPT_ADDRESS : CChainParams::SCRIPT_ADDRESS; @@ -232,7 +232,7 @@ bool IsValidDestinationString(const std::string& str, const CChainParams& params bool IsValidDestinationString(const std::string& str) { - return IsValidDestinationString(str, Params()); + return IsValidDestination(DecodeDestination(str, Params(), true)); } // @@ -240,7 +240,7 @@ bool IsValidDestinationString(const std::string& str) std::string EncodeParentDestination(const CTxDestination& dest) { - return boost::apply_visitor(DestinationEncoder(Params()), dest, true); + return boost::apply_visitor(DestinationEncoder(Params(), true), dest); } CTxDestination DecodeParentDestination(const std::string& str) diff --git a/src/mainchainrpc.cpp b/src/mainchainrpc.cpp index 322545c83b..ce1f2d1133 100644 --- a/src/mainchainrpc.cpp +++ b/src/mainchainrpc.cpp @@ -1,5 +1,6 @@ -#include #include + +#include #include #include #include diff --git a/src/mainchainrpc.h b/src/mainchainrpc.h index 1ff125047e..605faf11dd 100644 --- a/src/mainchainrpc.h +++ b/src/mainchainrpc.h @@ -6,15 +6,16 @@ #ifndef BITCOIN_MAINCHAINRPC_H #define BITCOIN_MAINCHAINRPC_H -#include "rpc/client.h" -#include "rpc/protocol.h" -#include "uint256.h" +#include +#include +#include #include #include -//#include -#include "univalue/include/univalue.h" +#include +//TODO(stevenroose) remove if not needed +//#include static const bool DEFAULT_NAMED=false; static const char DEFAULT_RPCCONNECT[] = "127.0.0.1"; @@ -40,7 +41,7 @@ UniValue CallMainChainRPC(const std::string& strMethod, const UniValue& params); // of confirmations. // For validating merkle blocks, you can provide the nbTxs parameter to verify if // it equals the number of transactions in the block. -bool IsConfirmedBitcoinBlock(const uint256& hash, int nMinConfirmationDepth, int nbTxs); +bool IsConfirmedBitcoinBlock(const uint256& hash, const int nMinConfirmationDepth, const int nbTxs); #endif // BITCOIN_MAINCHAINRPC_H diff --git a/src/rpc/util.cpp b/src/rpc/util.cpp index ba414bf3f5..b4925c9583 100644 --- a/src/rpc/util.cpp +++ b/src/rpc/util.cpp @@ -120,6 +120,14 @@ class DescribeAddressVisitor : public boost::static_visitor obj.pushKV("witness_program", HexStr(id.program, id.program + id.length)); return obj; } + + UniValue operator()(const NullData& id) const + { + UniValue obj(UniValue::VOBJ); + obj.pushKV("isscript", false); + obj.pushKV("iswitness", false); + return obj; + } }; UniValue DescribeAddress(const CTxDestination& dest) diff --git a/src/script/ismine.cpp b/src/script/ismine.cpp index 6a111f7432..a80b14d125 100644 --- a/src/script/ismine.cpp +++ b/src/script/ismine.cpp @@ -5,6 +5,7 @@ #include