It was brought to my attention that the runtime of this test is Too Damn High. The test is slow due to the many wait_for_getdata
s with delays (inbound peer + txid request) and the large volume of messages sent in the dos-related tests. This PR cuts the runtime by about 60% by reducing the number of messages/transactions and using setmocktime
instead of waiting.
On my machine, master:
084.51s user 1.55s system 57% cpu 2:28.53 total
After first commit (about 1min faster):
028.29s user 0.88s system 35% cpu 1:22.84 total
After second commit (about 30sec faster):
028.17s user 0.87s system 59% cpu 49.082 total
Reviewers should verify that the transactions in the DoS tests are still enough to cause evictions, and that the bumpmocktime
amounts are not more than necessary.
Alternatives:
- If we don’t like mocking the times, we can use outbound connections for all the peers. However, that approach won’t improve the runtime as much because we impose a 2-second delay on all txid requests regardless of peer type.
- Note that
noban_tx_relay
is not relevant for this test because all delays are related to downloading, not announcing.