decentralized-identity / decentralized-identity/ion
Improve Bitcoin Core `importpubkey` behavior on ION Bitcoin initialization
- Dominant language
- HTML
- Stars
- 1.2k
- Forks
- 166
- PR merge metrics
- No merged PRs in 30d
Description
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...
3. Add safeguard in places right before where `listunspent` occurs by calling `getwalletinfo` to make sure scanning is complete.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.