aboutsummaryrefslogtreecommitdiff
path: root/src/test/fuzz/txrequest.cpp
diff options
context:
space:
mode:
authorPieter Wuille <pieter@wuille.net>2020-10-09 11:44:06 -0700
committerPieter Wuille <pieter@wuille.net>2020-10-12 12:14:53 -0700
commitfd9a0060f028a4c01bd88f58777dea34bdcbafd1 (patch)
tree6fc17dc1233aa9e4ab056b6a1d22046bf7ebd3a8 /src/test/fuzz/txrequest.cpp
parent86f50ed10f66b5535f0162cf0026456a9e3f8963 (diff)
Report and verify expirations
Diffstat (limited to 'src/test/fuzz/txrequest.cpp')
-rw-r--r--src/test/fuzz/txrequest.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/test/fuzz/txrequest.cpp b/src/test/fuzz/txrequest.cpp
index 4a8e32d105..9529ad3274 100644
--- a/src/test/fuzz/txrequest.cpp
+++ b/src/test/fuzz/txrequest.cpp
@@ -246,11 +246,13 @@ public:
//! list of (sequence number, txhash, is_wtxid) tuples.
std::vector<std::tuple<uint64_t, int, bool>> result;
+ std::vector<std::pair<NodeId, GenTxid>> expected_expired;
for (int txhash = 0; txhash < MAX_TXHASHES; ++txhash) {
// Mark any expired REQUESTED announcements as COMPLETED.
for (int peer2 = 0; peer2 < MAX_PEERS; ++peer2) {
Announcement& ann2 = m_announcements[txhash][peer2];
if (ann2.m_state == State::REQUESTED && ann2.m_time <= m_now) {
+ expected_expired.emplace_back(peer2, GenTxid{ann2.m_is_wtxid, TXHASHES[txhash]});
ann2.m_state = State::COMPLETED;
break;
}
@@ -265,9 +267,13 @@ public:
}
// Sort the results by sequence number.
std::sort(result.begin(), result.end());
+ std::sort(expected_expired.begin(), expected_expired.end());
// Compare with TxRequestTracker's implementation.
- const auto actual = m_tracker.GetRequestable(peer, m_now);
+ std::vector<std::pair<NodeId, GenTxid>> expired;
+ const auto actual = m_tracker.GetRequestable(peer, m_now, &expired);
+ std::sort(expired.begin(), expired.end());
+ assert(expired == expected_expired);
m_tracker.PostGetRequestableSanityCheck(m_now);
assert(result.size() == actual.size());