Commit graph

12 commits

Author SHA1 Message Date
Larry Ruane
77ebad9651 improve MallocUsage() accuracy
Co-authored-by: Pieter Wuille <pieter@wuille.net>
Co-authored-by: Martin Leitner-Ankerl <martin.ankerl@gmail.com>
Co-authored-by: l0rinc <pap.lorinc@gmail.com>
2025-03-27 13:51:06 -06:00
Larry Ruane
f389bd8358 test: fill_mempool() should call sync_mempools() before returning
We saw a case where a test (p2p_1p1c_network.py) called
raise_network_minfee(), which called fill_mempool() using node 0.

Then raise_network_minfee() returned, and the test called rescan_utxos(),
which called getrawmempool() using a different node (node 1) followed by
getrawtransaction() on each returned transaction, and the test asserted
because a transaction was not found.

This was caused by the timing window between the call to getrawmempool()
and fetching the individual transactions; the transactions were still
being propagated on the P2P network. During this window, a transaction
(returned by getrawmempool()) was evicted (the mempool is close to full
during this test), and did not exist in the mempool by the time it was
attempted to be fetched.

It might make more sense for rescan_utxos() to call sync_mempools() just
before calling getrawmempool(), but it can't because rescan_utxos() is
part of the MiniWallet class, which doesn't have access to test_framework
(but that could probably be changed).
2025-03-27 13:47:41 -06:00
Sebastian Falbesoner
a6f50e791e test: ensure that fill_mempool leaves some room in mempool
Without this change, fill_mempool() may leave the mempool very close
to its memory size limit (-maxmempool). This can cause tests to
incorrectly fail when they submit another transaction expecting it
to succeed. Note that without this change, the same test that fails on
one platform may succeed on another, because their memory allocation
accounting algorithms (how they calculate memory usage, that is,
MallocUsage()) may be slightly different.
2025-03-27 12:16:04 -06:00
Greg Sanders
466e4df3fb assert_mempool_contents: assert not duplicates expected 2024-11-20 13:49:41 -05:00
Greg Sanders
e2e30e89ba functional test: Add ephemeral dust tests 2024-11-12 09:24:54 -05:00
tdb3
63f5e6ec79
test: add entry and expiration time checks 2024-10-25 17:11:27 -04:00
tdb3
93f48fceb7
test: add tx_in_orphanage()
Allows tests to check if a transaction
is contained within the orphanage
2024-10-02 18:23:27 -04:00
MarcoFalke
faf801515f
test: Add missing sync_mempools() to fill_mempool()
Also disable the function, when it is not needed.
2024-09-24 10:13:21 +02:00
MarcoFalke
fa48be6f02
test: Refactor fill_mempool to extract send_batch helper
This is needed for the next commit
2024-09-24 09:59:36 +02:00
Sebastian Falbesoner
dd8fa86193 test: use tagged ephemeral MiniWallet instance in fill_mempool 2024-05-05 12:36:51 +02:00
Sebastian Falbesoner
c8e6d08236 test: refactor: eliminate COINBASE_MATURITY magic number in fill_mempool 2024-05-05 12:33:34 +02:00
Sebastian Falbesoner
4f347140b1 test: refactor: move fill_mempool to new module mempool_util
This is needed to avoid circular dependencies in later commits.
Can be reviewed via `--color-moved=dimmed-zebra`.
2024-05-05 12:33:30 +02:00