From 02bbc053100ef99ca0f433b0a8c70961336ae79e Mon Sep 17 00:00:00 2001 From: Jesse Cohen Date: Fri, 8 Jun 2018 14:54:02 -0400 Subject: Rescope g_enable_bip61 to net_processing --- src/init.cpp | 2 -- src/net_processing.cpp | 12 ++++++++---- src/net_processing.h | 2 -- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/init.cpp b/src/init.cpp index 1b5507703c..1b1c40e083 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1134,8 +1134,6 @@ bool AppInitParameterInteraction() if (gArgs.GetBoolArg("-peerbloomfilters", DEFAULT_PEERBLOOMFILTERS)) nLocalServices = ServiceFlags(nLocalServices | NODE_BLOOM); - g_enable_bip61 = gArgs.GetBoolArg("-enablebip61", DEFAULT_ENABLE_BIP61); - if (gArgs.GetArg("-rpcserialversion", DEFAULT_RPC_SERIALIZE_VERSION) < 0) return InitError("rpcserialversion must be non-negative."); diff --git a/src/net_processing.cpp b/src/net_processing.cpp index de456e87f4..65f3914d36 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -37,7 +37,6 @@ #endif std::atomic nTimeBestReceived(0); // Used only to inform the wallet of when we last received a block -bool g_enable_bip61 = DEFAULT_ENABLE_BIP61; struct IteratorComparator { @@ -74,6 +73,9 @@ static const int HISTORICAL_BLOCK_AGE = 7 * 24 * 60 * 60; // Internal stuff namespace { + /** Enable BIP61 (sending reject messages) */ + bool g_enable_bip61 = DEFAULT_ENABLE_BIP61; + /** Number of nodes with fSyncStarted. */ int nSyncStarted = 0; @@ -811,6 +813,8 @@ static bool BlockRequestAllowed(const CBlockIndex* pindex, const Consensus::Para } PeerLogicValidation::PeerLogicValidation(CConnman* connmanIn, CScheduler &scheduler) : connman(connmanIn), m_stale_tip_check_time(0) { + g_enable_bip61 = gArgs.GetBoolArg("-enablebip61", DEFAULT_ENABLE_BIP61); + // Initialize global variables that cannot be constructed at startup. recentRejects.reset(new CRollingBloomFilter(120000, 0.000001)); @@ -867,7 +871,7 @@ static uint256 most_recent_block_hash; static bool fWitnessesPresentInMostRecentCompactBlock; /** - * Maintain state about the best-seen block and fast-announce a compact block + * Maintain state about the best-seen block and fast-announce a compact block * to compatible peers. */ void PeerLogicValidation::NewPoWValidBlock(const CBlockIndex *pindex, const std::shared_ptr& pblock) { @@ -912,7 +916,7 @@ void PeerLogicValidation::NewPoWValidBlock(const CBlockIndex *pindex, const std: } /** - * Update our best height and announce any block hashes which weren't previously + * Update our best height and announce any block hashes which weren't previously * in chainActive to our peers. */ void PeerLogicValidation::UpdatedBlockTip(const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload) { @@ -948,7 +952,7 @@ void PeerLogicValidation::UpdatedBlockTip(const CBlockIndex *pindexNew, const CB } /** - * Handle invalid block rejection and consequent peer banning, maintain which + * Handle invalid block rejection and consequent peer banning, maintain which * peers announce compact blocks. */ void PeerLogicValidation::BlockChecked(const CBlock& block, const CValidationState& state) { diff --git a/src/net_processing.h b/src/net_processing.h index b0b905d922..19e33f411a 100644 --- a/src/net_processing.h +++ b/src/net_processing.h @@ -37,8 +37,6 @@ static constexpr int64_t MINIMUM_CONNECT_TIME = 30; /** Default for BIP61 (sending reject messages) */ static constexpr bool DEFAULT_ENABLE_BIP61 = true; -/** Enable BIP61 (sending reject messages) */ -extern bool g_enable_bip61; class PeerLogicValidation final : public CValidationInterface, public NetEventsInterface { private: -- cgit v1.2.3