test: MiniWallet: skip mempool check if mempool_valid=False
Summary:
MiniWallet's core method for creating txs (`create_self_transfer`) right now always executes the `testmempoolaccept` RPC to check for mempool validity or invalidity. In some test cases where we use MiniWallet to create a huge number of transactions this can lead to performance issues (e.g. feature_fee_estimation.py where the execution time after MiniWallet usage almost doubled). Providing the possibility to skip the mempool checks is a mitigation for this.
Backport of core#24941.
The first commit is not backported because we diverged a lot from the core test and didn't convert it to MiniWallet yet, and the sign_tx function (which is not in our codebase yet) trivially needs the rehash anyway. So only this commit is relevant:
https://github.com/bitcoin/bitcoin/pull/24941/commits/a498acce4514d83d8dafcebaad522a89b6dc70fa
Test Plan:
ninja check-functional
Reviewers: #bitcoin_abc, sdulfari
Reviewed By: #bitcoin_abc, sdulfari
Subscribers: sdulfari
Differential Revision: https://reviews.bitcoinabc.org/D12730