From 3c8b3355948da9e36b3d876185f34f107d534826 Mon Sep 17 00:00:00 2001 From: Evan Duffield Date: Thu, 16 Jul 2015 03:00:16 -0700 Subject: [PATCH] Force txindex when a Mastenode --- src/init.cpp | 6 ++++++ src/masternodeconfig.h | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/src/init.cpp b/src/init.cpp index 1b1d7f0999..e36c71693d 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1457,6 +1457,12 @@ bool AppInit2(boost::thread_group& threadGroup) fMasterNode = GetBoolArg("-masternode", false); + + if((fMasterNode || masternodeConfig.getCount() > -1) && fTxIndex == false) { + return InitError("Enabling Masternode support requires turning on transaction indexing." + "Please add txindex=1 to your configuration and start with --reindex=1"); + } + if(fMasterNode) { LogPrintf("IS DARKSEND MASTER NODE\n"); strMasterNodeAddr = GetArg("-masternodeaddr", ""); diff --git a/src/masternodeconfig.h b/src/masternodeconfig.h index a8d19b931d..59e7012c30 100644 --- a/src/masternodeconfig.h +++ b/src/masternodeconfig.h @@ -91,6 +91,14 @@ public: return entries; } + int getCount() { + int c = -1; + BOOST_FOREACH(CMasternodeEntry e, entries) { + if(e.getAlias() != "") c++; + } + return c; + } + private: std::vector entries;