Skip to content

Fix Issue (#1228): Eliminate offchainRegistry#2274

Open
dimension-drifter wants to merge 1 commit intoergoplatform:masterfrom
dimension-drifter:fix/issue-1228
Open

Fix Issue (#1228): Eliminate offchainRegistry#2274
dimension-drifter wants to merge 1 commit intoergoplatform:masterfrom
dimension-drifter:fix/issue-1228

Conversation

@dimension-drifter
Copy link

Problem:
Currently, the wallet maintains a separate offChainRegistry to track off-chain transactions and boxes. This registry is updated when:

  • New transactions enter the mempool (ScanOffChain message)
  • Blocks are applied (updateOnBlock)

However, the wallet is not notified when transactions are removed from the mempool due to:

  • Being invalidated
  • Being replaced by higher-fee double-spends
  • Expiring from the mempool

This causes the offChainRegistry to become stale, showing boxes that are no longer available in the mempool.

Solution:
Eliminate offChainRegistry entirely and query the mempool directly when off-chain boxes are needed. The wallet already receives ChangedMempool events and maintains mempoolReaderOpt, so we can:

  • Extract off-chain boxes from mempoolReaderOpt on-demand
  • Remove the offChainRegistry field from ErgoWalletState
  • Remove OffChainRegistry class
  • Simplify WalletScanLogic.scanBlockTransactions to only update WalletRegistry
  • Remove ScanOffChain message handling (no longer needed - mempool updates are sufficient)

Changes:

  • Modified ErgoWalletState to remove offChainRegistry field
  • Added helper methods to extract off-chain boxes directly from mempool
  • Updated ErgoWalletService methods to use mempool directly
  • Removed OffChainRegistry class
  • Updated WalletScanLogic to only return WalletRegistry updates
  • Removed ScanOffChain handling from ErgoWalletActor
  • Updated all tests

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