bdk icon indicating copy to clipboard operation
bdk copied to clipboard

Retry failed RPC calls on error

Open afilini opened this issue 3 years ago • 1 comments

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 fmt and cargo clippy before 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 avatar Aug 09 '22 15:08 afilini

@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).

evanlinjin avatar Aug 11 '22 05:08 evanlinjin

Closing this for now as this deals with legacy code.

evanlinjin avatar Jan 19 '24 15:01 evanlinjin