diff --git a/src/wallet/rpcdump.cpp b/src/wallet/rpcdump.cpp --- a/src/wallet/rpcdump.cpp +++ b/src/wallet/rpcdump.cpp @@ -327,8 +327,8 @@ auto locked_chain = pwallet->chain().lock(); LOCK(pwallet->cs_wallet); - CTxDestination dest = DecodeDestination(request.params[0].get_str(), - config.GetChainParams()); + CTxDestination dest = + DecodeDestination(request.params[0].get_str(), wallet->chainParams); if (IsValidDestination(dest)) { if (fP2SH) { throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, @@ -846,8 +846,7 @@ EnsureWalletIsUnlocked(pwallet); std::string strAddress = request.params[0].get_str(); - CTxDestination dest = - DecodeDestination(strAddress, config.GetChainParams()); + CTxDestination dest = DecodeDestination(strAddress, wallet->chainParams); 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 @@ -336,7 +336,7 @@ LOCK(pwallet->cs_wallet); CTxDestination dest = - DecodeDestination(request.params[0].get_str(), config.GetChainParams()); + DecodeDestination(request.params[0].get_str(), wallet->chainParams); if (!IsValidDestination(dest)) { throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Bitcoin address"); @@ -463,7 +463,7 @@ LOCK(pwallet->cs_wallet); CTxDestination dest = - DecodeDestination(request.params[0].get_str(), config.GetChainParams()); + DecodeDestination(request.params[0].get_str(), wallet->chainParams); if (!IsValidDestination(dest)) { throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid address"); } @@ -613,8 +613,7 @@ std::string strAddress = request.params[0].get_str(); std::string strMessage = request.params[1].get_str(); - CTxDestination dest = - DecodeDestination(strAddress, config.GetChainParams()); + CTxDestination dest = DecodeDestination(strAddress, wallet->chainParams); if (!IsValidDestination(dest)) { throw JSONRPCError(RPC_TYPE_ERROR, "Invalid address"); } @@ -696,7 +695,7 @@ // Bitcoin address CTxDestination dest = - DecodeDestination(request.params[0].get_str(), config.GetChainParams()); + DecodeDestination(request.params[0].get_str(), wallet->chainParams); if (!IsValidDestination(dest)) { throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Bitcoin address"); @@ -720,7 +719,7 @@ TxValidationState state; if (wtx.IsCoinBase() || !locked_chain->contextualCheckTransactionForCurrentBlock( - config.GetChainParams().GetConsensus(), *wtx.tx, state)) { + wallet->chainParams.GetConsensus(), *wtx.tx, state)) { continue; } @@ -794,7 +793,7 @@ TxValidationState state; if (wtx.IsCoinBase() || !locked_chain->contextualCheckTransactionForCurrentBlock( - config.GetChainParams().GetConsensus(), *wtx.tx, state)) { + wallet->chainParams.GetConsensus(), *wtx.tx, state)) { continue; } @@ -1026,7 +1025,7 @@ std::vector keys = sendTo.getKeys(); for (const std::string &name_ : keys) { - CTxDestination dest = DecodeDestination(name_, config.GetChainParams()); + CTxDestination dest = DecodeDestination(name_, wallet->chainParams); if (!IsValidDestination(dest)) { throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, std::string("Invalid Bitcoin address: ") + @@ -1152,7 +1151,7 @@ keys_or_addrs[i].get_str().length() == 130)) { pubkeys.push_back(HexToPubKey(keys_or_addrs[i].get_str())); } else { - pubkeys.push_back(AddrToPubKey(config.GetChainParams(), spk_man, + pubkeys.push_back(AddrToPubKey(wallet->chainParams, spk_man, keys_or_addrs[i].get_str())); } } @@ -1204,12 +1203,12 @@ CTxDestination filtered_address = CNoDestination(); if (!by_label && params.size() > 3) { if (!IsValidDestinationString(params[3].get_str(), - config.GetChainParams())) { + pwallet->chainParams)) { throw JSONRPCError(RPC_WALLET_ERROR, "address_filter parameter was invalid"); } filtered_address = - DecodeDestination(params[3].get_str(), config.GetChainParams()); + DecodeDestination(params[3].get_str(), pwallet->chainParams); has_filtered_address = true; } @@ -1221,7 +1220,7 @@ TxValidationState state; if (wtx.IsCoinBase() || !locked_chain.contextualCheckTransactionForCurrentBlock( - config.GetChainParams().GetConsensus(), *wtx.tx, state)) { + pwallet->chainParams.GetConsensus(), *wtx.tx, state)) { continue; } @@ -3443,7 +3442,7 @@ for (size_t idx = 0; idx < inputs.size(); idx++) { const UniValue &input = inputs[idx]; CTxDestination dest = - DecodeDestination(input.get_str(), config.GetChainParams()); + DecodeDestination(input.get_str(), wallet->chainParams); if (!IsValidDestination(dest)) { throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, std::string("Invalid Bitcoin address: ") + @@ -4256,7 +4255,7 @@ UniValue ret(UniValue::VOBJ); CTxDestination dest = - DecodeDestination(request.params[0].get_str(), config.GetChainParams()); + DecodeDestination(request.params[0].get_str(), wallet->chainParams); // Make sure the destination is valid if (!IsValidDestination(dest)) { throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid address"); @@ -4781,7 +4780,7 @@ Amount fee; int change_position; CMutableTransaction rawTx = - ConstructTransaction(config.GetChainParams(), request.params[0], + ConstructTransaction(wallet->chainParams, request.params[0], request.params[1], request.params[2]); FundTransaction(pwallet, rawTx, fee, change_position, request.params[3]); diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -2082,7 +2082,7 @@ // Quick answer in most cases TxValidationState state; if (!locked_chain.contextualCheckTransactionForCurrentBlock( - Params().GetConsensus(), *tx, state)) { + this->pwallet->chainParams.GetConsensus(), *tx, state)) { return false; } @@ -2290,7 +2290,7 @@ const int max_depth = {coinControl ? coinControl->m_max_depth : DEFAULT_MAX_DEPTH}; - const Consensus::Params params = Params().GetConsensus(); + const Consensus::Params params = this->chainParams.GetConsensus(); std::set trusted_parents; for (const auto &entry : mapWallet) {