Conversation
sidhujag
commented
Mar 4, 2026
- btc checkpoint precompiles
- bootstrap feature
sync 30m from 2h on mainnet
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fd5739b4b2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if err != nil { | ||
| return err | ||
| } | ||
| if err := os.RemoveAll(chaindataPath); err != nil { |
There was a problem hiding this comment.
Delay chaindata deletion until bootstrap install is guaranteed
The install flow deletes the existing chaindata directory before attempting moveOrCopyDir, so a failed copy/rename (for example, cross-device copy failing due to disk full or I/O error) leaves the node with neither the old state nor a complete new state. This is especially dangerous when --syscoin.statebootstrap.force is used on a live datadir, because a transient install failure becomes destructive data loss.
Useful? React with 👍 / 👎.
| hc.BTCCheckpointIndexCache.Add(btcHash, existingIdx) | ||
| return | ||
| } | ||
| hc.BTCCheckpointLastIndex++ |
There was a problem hiding this comment.
Guard BTCCheckpointLastIndex with synchronization
BTCCheckpointLastIndex is mutated in write/delete paths and read in query paths without any mutex/atomic protection, so concurrent block ingestion and RPC/VM reads can race on this shared field. In practice, precompile calls can observe inconsistent values (and on 32-bit builds, torn 64-bit reads are possible), so this counter should be guarded with synchronization similar to other shared chain state.
Useful? React with 👍 / 👎.