diff --git a/src/Config.cpp b/src/Config.cpp index 6e4b67ce87..0ca3ec46cd 100644 --- a/src/Config.cpp +++ b/src/Config.cpp @@ -121,6 +121,7 @@ void Config::setup(const std::string& strConf) // a new ledger every minute LEDGER_SECONDS = 60; + LEDGER_CREATOR = false; RPC_USER = "admin"; RPC_PASSWORD = "pass"; @@ -201,6 +202,9 @@ void Config::load() if (sectionSingleB(secConfig, SECTION_RPC_PORT, strTemp)) RPC_PORT = boost::lexical_cast(strTemp); + if (sectionSingleB(secConfig, "ledger_creator" , strTemp)) + LEDGER_CREATOR = boost::lexical_cast(strTemp); + if (sectionSingleB(secConfig, SECTION_RPC_ALLOW_REMOTE, strTemp)) RPC_ALLOW_REMOTE = boost::lexical_cast(strTemp); diff --git a/src/Config.h b/src/Config.h index 6a88d13cfe..7c900523f5 100644 --- a/src/Config.h +++ b/src/Config.h @@ -54,12 +54,15 @@ public: std::vector VALIDATORS; // Validators from newcoind.cfg. std::vector IPS; // Peer IPs from newcoind.cfg. + + // Network parameters int NETWORK_START_TIME; // The Unix time we start ledger 0. int TRANSACTION_FEE_BASE; int LEDGER_SECONDS; int LEDGER_PROPOSAL_DELAY_SECONDS; int LEDGER_AVALANCHE_SECONDS; + bool LEDGER_CREATOR; // should be false unless we are starting a new ledger // Note: The following parameters do not relate to the UNL or trust at all int NETWORK_QUORUM; // Minimum number of nodes to consider the network present diff --git a/src/NetworkOPs.cpp b/src/NetworkOPs.cpp index c29da13f69..4d3485c479 100644 --- a/src/NetworkOPs.cpp +++ b/src/NetworkOPs.cpp @@ -369,10 +369,15 @@ bool NetworkOPs::checkLastClosedLedger(const std::vector& peerLis } Ledger::pointer ourClosed = mLedgerMaster->getClosedLedger(); - uint256 closedLedger = ourClosed->getHash(); - ValidationCount& ourVC = ledgers[closedLedger]; - ++ourVC.nodesUsing; - ourVC.highNode = theApp->getWallet().getNodePublic(); + uint256 closedLedger=0; + if(theConfig.LEDGER_CREATOR || ourClosed->getLedgerSeq() > 100) + { + closedLedger = ourClosed->getHash(); + ValidationCount& ourVC = ledgers[closedLedger]; + ++ourVC.nodesUsing; + ourVC.highNode = theApp->getWallet().getNodePublic(); + } + for (std::vector::const_iterator it = peerList.begin(), end = peerList.end(); it != end; ++it) {