Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Bitcoin Core importpubkey behavior on ION Bitcoin initialization #277

Open
thehenrytsai opened this issue Jun 24, 2022 · 0 comments
Labels
improvement Improvement to an existing feature that does not require a fork

Comments

@thehenrytsai
Copy link
Collaborator

thehenrytsai commented Jun 24, 2022

Currently on fresh setup of ION Bitcoin service initialization, the importpubkey RPC is made to scan the entire blockchain from genesis for transactions associated with the wallet address specified. There are a few problems with this:

  1. This can take hours.
  2. This network call is a blocking, synchronous call, meaning it does not return until the scanning is complete. Even though we can use getwalletinfo to obtain the scanning status asynchronously.

There might be an opportunity to improve this behavior. Upon reviewing the code, it appears that this call is important because all writes (by both ION Core & LockMonitor) will subsequently depend on listunspent RPC to get the unspent coins to spend. But maybe we don't have to block initialization on importpubkey and let it occur in the background asynchronously. Two possible choices for writes:

  1. Not do any additional safeguarding, if writes attempt to spend invalid coins, the miners obviously won't let it. There is concern here as to how we (if at all) detect/handle rejected transaction broadcasted...
  2. Add safeguard in places right before where listunspent occurs by calling getwalletinfo to make sure scanning is complete.
@thehenrytsai thehenrytsai added the improvement Improvement to an existing feature that does not require a fork label Jun 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Improvement to an existing feature that does not require a fork
Projects
None yet
Development

No branches or pull requests

1 participant