mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-06 18:53:21 +01:00
Report and verify expirations
This commit is contained in:
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user