aboutsummaryrefslogtreecommitdiff
path: root/src/net_processing.cpp
diff options
context:
space:
mode:
authorSuhas Daftuar <sdaftuar@gmail.com>2017-10-26 10:32:46 -0400
committerSuhas Daftuar <sdaftuar@gmail.com>2017-11-02 12:39:14 -0400
commit626291508c433488439b662f2e88882048fb59fb (patch)
treef09d67b67497f85d76def9de2783048ec23aa109 /src/net_processing.cpp
parent83df25736ebaa23777e965d265ed677a8d79f23f (diff)
downloadbitcoin-626291508c433488439b662f2e88882048fb59fb.tar.xz
Add unit test for stale tip checking
Diffstat (limited to 'src/net_processing.cpp')
-rw-r--r--src/net_processing.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/net_processing.cpp b/src/net_processing.cpp
index 3aa13fff43..faa0c7620b 100644
--- a/src/net_processing.cpp
+++ b/src/net_processing.cpp
@@ -550,6 +550,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)