Add txrequest unit tests

Add unit tests for TxRequestTracker. Several scenarios are tested,
randomly interleaved with eachother.

Includes a test by Antoine Riard (ariard).
This commit is contained in:
Pieter Wuille
2020-09-29 16:10:16 -07:00
parent da3b8fde03
commit 3c7fe0e5a0
4 changed files with 857 additions and 1 deletions

View File

@@ -192,6 +192,18 @@ public:
/** Count how many announcements are being tracked in total across all peers and transaction hashes. */
size_t Size() const;
/** Access to the internal priority computation (testing only) */
uint64_t ComputePriority(const uint256& txhash, NodeId peer, bool preferred) const;
/** Run internal consistency check (testing only). */
void SanityCheck() const;
/** Run a time-dependent internal consistency check (testing only).
*
* This can only be called immediately after GetRequestable, with the same 'now' parameter.
*/
void PostGetRequestableSanityCheck(std::chrono::microseconds now) const;
};
#endif // BITCOIN_TXREQUEST_H