diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp --- a/src/rpc/mining.cpp +++ b/src/rpc/mining.cpp @@ -205,7 +205,8 @@ nMaxTries = request.params[2].get_int(); } - CTxDestination destination = DecodeDestination(request.params[1].get_str()); + CTxDestination destination = + DecodeDestination(request.params[1].get_str(), config.GetChainParams()); if (!IsValidDestination(destination)) { throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Error: Invalid address"); diff --git a/src/rpc/misc.cpp b/src/rpc/misc.cpp --- a/src/rpc/misc.cpp +++ b/src/rpc/misc.cpp @@ -232,7 +232,8 @@ LOCK(cs_main); #endif - CTxDestination dest = DecodeDestination(request.params[0].get_str()); + CTxDestination dest = + DecodeDestination(request.params[0].get_str(), config.GetChainParams()); bool isValid = IsValidDestination(dest); UniValue ret(UniValue::VOBJ); @@ -450,7 +451,8 @@ std::string strSign = request.params[1].get_str(); std::string strMessage = request.params[2].get_str(); - CTxDestination destination = DecodeDestination(strAddress); + CTxDestination destination = + DecodeDestination(strAddress, config.GetChainParams()); if (!IsValidDestination(destination)) { throw JSONRPCError(RPC_TYPE_ERROR, "Invalid address"); } diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp --- a/src/rpc/rawtransaction.cpp +++ b/src/rpc/rawtransaction.cpp @@ -548,7 +548,8 @@ CTxOut out(Amount(0), CScript() << OP_RETURN << data); rawTx.vout.push_back(out); } else { - CTxDestination destination = DecodeDestination(name_); + CTxDestination destination = + DecodeDestination(name_, config.GetChainParams()); if (!IsValidDestination(destination)) { throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, std::string("Invalid Bitcoin address: ") + diff --git a/src/wallet/rpcdump.cpp b/src/wallet/rpcdump.cpp --- a/src/wallet/rpcdump.cpp +++ b/src/wallet/rpcdump.cpp @@ -4,6 +4,7 @@ #include "base58.h" #include "chain.h" +#include "config.h" #include "core_io.h" #include "dstencode.h" #include "init.h" @@ -270,7 +271,8 @@ LOCK2(cs_main, pwallet->cs_wallet); - CTxDestination dest = DecodeDestination(request.params[0].get_str()); + CTxDestination dest = + DecodeDestination(request.params[0].get_str(), config.GetChainParams()); if (IsValidDestination(dest)) { if (fP2SH) { throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, @@ -646,7 +648,8 @@ EnsureWalletIsUnlocked(pwallet); std::string strAddress = request.params[0].get_str(); - CTxDestination dest = DecodeDestination(strAddress); + CTxDestination dest = + DecodeDestination(strAddress, config.GetChainParams()); if (!IsValidDestination(dest)) { throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Bitcoin address"); diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -312,7 +312,8 @@ LOCK2(cs_main, pwallet->cs_wallet); - CTxDestination dest = DecodeDestination(request.params[0].get_str()); + CTxDestination dest = + DecodeDestination(request.params[0].get_str(), config.GetChainParams()); if (!IsValidDestination(dest)) { throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Bitcoin address"); @@ -369,7 +370,8 @@ LOCK2(cs_main, pwallet->cs_wallet); - CTxDestination dest = DecodeDestination(request.params[0].get_str()); + CTxDestination dest = + DecodeDestination(request.params[0].get_str(), config.GetChainParams()); if (!IsValidDestination(dest)) { throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Bitcoin address"); @@ -532,7 +534,8 @@ LOCK2(cs_main, pwallet->cs_wallet); - CTxDestination dest = DecodeDestination(request.params[0].get_str()); + CTxDestination dest = + DecodeDestination(request.params[0].get_str(), config.GetChainParams()); if (!IsValidDestination(dest)) { throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid address"); } @@ -669,7 +672,8 @@ std::string strAddress = request.params[0].get_str(); std::string strMessage = request.params[1].get_str(); - CTxDestination dest = DecodeDestination(strAddress); + CTxDestination dest = + DecodeDestination(strAddress, config.GetChainParams()); if (!IsValidDestination(dest)) { throw JSONRPCError(RPC_TYPE_ERROR, "Invalid address"); } @@ -737,7 +741,8 @@ LOCK2(cs_main, pwallet->cs_wallet); // Bitcoin address - CTxDestination dest = DecodeDestination(request.params[0].get_str()); + CTxDestination dest = + DecodeDestination(request.params[0].get_str(), config.GetChainParams()); if (!IsValidDestination(dest)) { throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Bitcoin address"); @@ -1079,7 +1084,8 @@ LOCK2(cs_main, pwallet->cs_wallet); std::string strAccount = AccountFromValue(request.params[0]); - CTxDestination dest = DecodeDestination(request.params[1].get_str()); + CTxDestination dest = + DecodeDestination(request.params[1].get_str(), config.GetChainParams()); if (!IsValidDestination(dest)) { throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Bitcoin address"); @@ -1233,7 +1239,7 @@ Amount totalAmount(0); std::vector keys = sendTo.getKeys(); for (const std::string &name_ : keys) { - CTxDestination dest = DecodeDestination(name_); + CTxDestination dest = DecodeDestination(name_, config.GetChainParams()); if (!IsValidDestination(dest)) { throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, std::string("Invalid Bitcoin address: ") + @@ -3121,7 +3127,8 @@ UniValue inputs = request.params[2].get_array(); for (size_t idx = 0; idx < inputs.size(); idx++) { const UniValue &input = inputs[idx]; - CTxDestination dest = DecodeDestination(input.get_str()); + CTxDestination dest = + DecodeDestination(input.get_str(), config.GetChainParams()); if (!IsValidDestination(dest)) { throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, std::string("Invalid Bitcoin address: ") + @@ -3321,7 +3328,8 @@ if (options.exists("changeAddress")) { CTxDestination dest = - DecodeDestination(options["changeAddress"].get_str()); + DecodeDestination(options["changeAddress"].get_str(), + config.GetChainParams()); if (!IsValidDestination(dest)) { throw JSONRPCError(