Skip to content

Add the RPC `fillmempool` (regtest only)

This MR is a pre-requisite for !1782 (merged).


Summary

For upcoming ABLA work, it may be beneficial to be able to fill a node's mempool with transactions quickly from a functional test. Doing this from Python on the client side is painfully slow. The fastest way is to have the node do it to itself in C++.

This MR does just that: a new RPC has been added called fillmempool which only works on regtest. It fills the mempool with anyone-can-spend txns, up to a specified dynamic size. On my system, a 320 MB mempool can be filled in under 20 seconds using this RPC (as compared to tens of minutes to hours if done from the client-side using Python).

Test Plan

  • ninja all check-all
  • (Optional) Start a regtest node: ./src/bitcoind -regtest -debug=mempool and hit it with bitcoin-cli fillmempool 5 (replace 5 with various sizes from 1 to 320). You can observe it working and use getmempoolinfo RPC to verify it did indeed fill the mempool.
    • Note: this RPC has a "fuzziness" as to how well it can fill the mempool -- it is accurate to within +/- 500 bytes (it may go over, or it may go under by at most 500 bytes).
Edited by Calin Culianu

Merge request reports