Retry failed RPC calls on error
Description
Whenever the transport errors with "WouldBlock" we wait a bit and retry the call.
This partially fixes #650, at least the errors happening with the RPC blockchain reported here: https://github.com/bitcoindevkit/bdk/issues/650#issuecomment-1182990519
Notes to the reviewers
I'm a bit puzzled because in my tests I still have failures, but this time with the error:
Rpc(JsonRpc(Rpc(RpcError { code: -4, message: "Wallet is currently rescanning. Abort existing rescan or wait.", data: None })))
even though the wallet have just been created. I even tried adding another "await_wallet_scan" before our importdescriptors and it didn't make any difference.
To consistently reproduce this issue I ran the tests in a large (>=16 vCPUs) instance on AWS.
Checklists
All Submissions:
- [x] I've signed all my commits
- [x] I followed the contribution guidelines
- [x] I ran
cargo fmtandcargo clippybefore committing
New Features:
- [ ] I've added tests for the new feature
- [ ] I've added docs for the new feature
- [ ] I've updated
CHANGELOG.md
Bugfixes:
- [ ] This pull request breaks the existing API
- [ ] I've added tests to reproduce the issue which are now passing
- [x] I'm linking the issue being fixed by this PR
@afilini Let me know if this is helpful in dealing with the code: -4 errors: https://github.com/afilini/bdk/pull/5
In either case, I feel like this is a good-to-have, just in case a wallet rescan is triggered elsewhere (rather than BDK).
Closing this for now as this deals with legacy code.