Skip to content

Prevent wallet scans from following forked blocks#50

Draft
zpalmtree wants to merge 1 commit into
blocknetprivacy:masterfrom
zpalmtree:codex/wallet-reorg-prevention
Draft

Prevent wallet scans from following forked blocks#50
zpalmtree wants to merge 1 commit into
blocknetprivacy:masterfrom
zpalmtree:codex/wallet-reorg-prevention

Conversation

@zpalmtree

Copy link
Copy Markdown
Contributor

Summary

  • persist wallet scan block hashes and source block hashes on owned outputs
  • rewind wallet sync state when its recorded tip hash no longer matches the canonical chain before scanning more blocks
  • stop notifying wallet/UI block subscribers for submitted side-chain blocks

Why

Wallet subscribers could scan an accepted side-chain or later-reorged block and record outputs that are not spendable on the canonical chain. This patch makes wallet scanning follow canonical block hashes instead of height alone.

Validation

  • cargo build --release (crypto-rs)
  • go build ./...
  • go test ./wallet
  • go test -run 'TestRewindWalletToCanonicalTip|TestHandleLoadWallet_ReorgAtSameHeight|TestCLIRecoverWalletAfterChainReset|TestHandleLoadWallet_ResponseIncludesSyncProgress' .\n\nFull go test ./... still hits the existing local libp2p self-dial failures in blocknet and blocknet/p2p.

@zpalmtree zpalmtree force-pushed the codex/wallet-reorg-prevention branch from 1c4d94d to 53b726d Compare May 20, 2026 03:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant