mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-26 17:52:13 +01:00
[fuzz] GetCandidatePeers
This commit is contained in:
parent
7704139cf0
commit
c4cc61db98
@ -295,6 +295,19 @@ public:
|
||||
tracked += m_announcements[txhash][peer].m_state != State::NOTHING;
|
||||
inflight += m_announcements[txhash][peer].m_state == State::REQUESTED;
|
||||
candidates += m_announcements[txhash][peer].m_state == State::CANDIDATE;
|
||||
|
||||
std::bitset<MAX_PEERS> expected_announcers;
|
||||
for (int peer = 0; peer < MAX_PEERS; ++peer) {
|
||||
if (m_announcements[txhash][peer].m_state == State::CANDIDATE || m_announcements[txhash][peer].m_state == State::REQUESTED) {
|
||||
expected_announcers[peer] = true;
|
||||
}
|
||||
}
|
||||
std::vector<NodeId> candidate_peers;
|
||||
m_tracker.GetCandidatePeers(TXHASHES[txhash], candidate_peers);
|
||||
assert(expected_announcers.count() == candidate_peers.size());
|
||||
for (const auto& peer : candidate_peers) {
|
||||
assert(expected_announcers[peer]);
|
||||
}
|
||||
}
|
||||
assert(m_tracker.Count(peer) == tracked);
|
||||
assert(m_tracker.CountInFlight(peer) == inflight);
|
||||
|
Loading…
x
Reference in New Issue
Block a user