From 3df7c4c8c01cdca3188fdeb9f1ff6f7af6c003b3 Mon Sep 17 00:00:00 2001 From: Daira Hopwood Date: Thu, 9 Feb 2017 23:59:56 +0000 Subject: [PATCH] Address @str4d's comment about the case where -gen is not set. Also avoid shadowing mineToLocalWallet variable. Signed-off-by: Daira Hopwood --- src/init.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/init.cpp b/src/init.cpp index 0df20e242..7bb07e3bc 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1508,18 +1508,16 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler) #ifdef ENABLE_MINING #ifndef ENABLE_WALLET - auto mineToLocalWallet = GetBoolArg("-minetolocalwallet", false); - if (mineToLocalWallet) { + if (GetBoolArg("-minetolocalwallet", false)) { return InitError(_("Zcash was not built with wallet support. Set -minetolocalwallet=0 to use -mineraddress, or rebuild Zcash with wallet support.")); } - if (!mapArgs.count("-mineraddress")) { + if (GetArg("-mineraddress", "").empty() && GetBoolArg("-gen", false)) { return InitError(_("Zcash was not built with wallet support. Set -mineraddress, or rebuild Zcash with wallet support.")); } #endif // !ENABLE_WALLET if (mapArgs.count("-mineraddress")) { #ifdef ENABLE_WALLET - auto mineToLocalWallet = GetBoolArg("-minetolocalwallet", true); bool minerAddressInLocalWallet = false; if (pwalletMain) { // Address has alreday been validated @@ -1528,7 +1526,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler) addr.GetKeyID(keyID); minerAddressInLocalWallet = pwalletMain->HaveKey(keyID); } - if (mineToLocalWallet && !minerAddressInLocalWallet) { + if (GetBoolArg("-minetolocalwallet", true) && !minerAddressInLocalWallet) { return InitError(_("-mineraddress is not in the local wallet. Either use a local address, or set -minetolocalwallet=0")); } #endif // ENABLE_WALLET