Before:
```
wallet_resendwallettransactions.py | ✓ Passed | 14 s
```
After
```
wallet_resendwallettransactions.py | ✓ Passed | 3 s
```
Also fixes [[https://github.com/bitcoin/bitcoin/pull/20143 | core#20143]]
This is a backport of [[https://github.com/bitcoin/bitcoin/pull/20112 | core#20112]]