Skip stale tip checking if outbound connections are off or if reindexing.

This commit is contained in:
Gregory Maxwell
2018-08-22 23:29:01 +00:00
parent 271b379e63
commit 66b3fc5437
3 changed files with 10 additions and 5 deletions

View File

@@ -9,6 +9,9 @@
#include <net.h>
#include <validationinterface.h>
#include <consensus/params.h>
#include <sync.h>
extern CCriticalSection cs_main;
/** Default for -maxorphantx, maximum number of orphan transactions kept in memory */
static const unsigned int DEFAULT_MAX_ORPHAN_TRANSACTIONS = 100;
@@ -65,7 +68,7 @@ public:
/** Evict extra outbound peers. If we think our tip may be stale, connect to an extra outbound */
void CheckForStaleTipAndEvictPeers(const Consensus::Params &consensusParams);
/** If we have extra outbound peers, try to disconnect the one with the oldest block announcement */
void EvictExtraOutboundPeers(int64_t time_in_seconds);
void EvictExtraOutboundPeers(int64_t time_in_seconds) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
private:
int64_t m_stale_tip_check_time; //! Next time to check for stale tip