This fixes #25229
I tested on Fedora with below steps and could list transactions several times on PR branch while Master branch bitcoind crashed in running listtransactions:
- Add thousands of transactions in a wallet on regtest with
bitcoin-cli generatetoaddress 100000 ADDRESS - Run
listtransactionscommand multiple times in Master and PR branch:bitcoin-cli listtransactions "*" 100000 1000 - Keep an eye on CPU and memory usage with
top