| 841 | } |
| 842 | |
| 843 | PeerLogicValidation::PeerLogicValidation(CConnman* connmanIn, CScheduler &scheduler, bool enable_bip61) |
| 844 | : connman(connmanIn), m_stale_tip_check_time(0), m_enable_bip61(enable_bip61) { |
| 845 | |
| 846 | // Initialize global variables that cannot be constructed at startup. |
| 847 | recentRejects.reset(new CRollingBloomFilter(120000, 0.000001)); |
| 848 | |
| 849 | const Consensus::Params& consensusParams = Params().GetConsensus(); |
| 850 | // Stale tip checking and peer eviction are on two different timers, but we |
| 851 | // don't want them to get out of sync due to drift in the scheduler, so we |
| 852 | // combine them in one function and schedule at the quicker (peer-eviction) |
| 853 | // timer. |
| 854 | static_assert(EXTRA_PEER_CHECK_INTERVAL < STALE_CHECK_INTERVAL, "peer eviction timer should be less than stale tip check timer"); |
| 855 | scheduler.scheduleEvery(std::bind(&PeerLogicValidation::CheckForStaleTipAndEvictPeers, this, consensusParams), EXTRA_PEER_CHECK_INTERVAL * 1000); |
| 856 | } |
| 857 | |
| 858 | /** |
| 859 | * Evict orphan txn pool entries (EraseOrphanTx) based on a newly connected |
nothing calls this directly
no test coverage detected