Add unit test for stale tip checking

Github-Pull: #11560
Rebased-From: 626291508c
This commit is contained in:
Suhas Daftuar
2017-10-26 10:32:46 -04:00
committed by MarcoFalke
parent 2ed0647ac1
commit fc308a6cdb
2 changed files with 94 additions and 0 deletions

View File

@@ -543,6 +543,15 @@ void FindNextBlocksToDownload(NodeId nodeid, unsigned int count, std::vector<con
} // namespace
// This function is used for testing the stale tip eviction logic, see
// DoS_tests.cpp
void UpdateLastBlockAnnounceTime(NodeId node, int64_t time_in_seconds)
{
LOCK(cs_main);
CNodeState *state = State(node);
if (state) state->m_last_block_announcement = time_in_seconds;
}
// Returns true for outbound peers, excluding manual connections, feelers, and
// one-shots
bool IsOutboundDisconnectionCandidate(const CNode *node)