ZCash sync ends up in a permanently failing state. The errors point to a desync between the FsBlockDb compact-block cache on disk and its metadata/database: the kit tries to scan, write metadata for, or remove block files that no longer exist on the filesystem. The failure is intermittent in the sense that a different one of the three errors below surfaces on each attempt (not all at once).
Steps to reproduce
- Start with a previously synced ZEC wallet that is currently disabled in the coin manager.
- Without enabling the ZEC coin manager, perform a swap and buy ZEC.
- ZEC gets added and begins syncing — but it starts syncing from the very beginning (showed >2,900,000 remaining blocks) instead of resuming from the previously synced height.
- In the coin manager, disable ZEC and re-enable it, setting restoreHeight to ~2 months ago.
- Sync restarts and shows >69,000 remaining blocks.
- After some time, sync starts failing with the errors below and never recovers.
Observed errors (one of these per attempt)
ERROR ZCashKit: State: Error: rustScanBlocks("Error while scanning blocks:
The underlying block store produced the following error: Failed to access
the file system: No such file or directory (os error 2)")
ERROR ZCashKit: State: Error: rustWriteBlocksMetadata("Failed to write block
metadata to FsBlockDb: MissingBlockPath("/var/mobile/Containers/Data/
Application/<APP_CONTAINER_UUID>/Library/Application Support/z-cash-kit/
<WALLET_ACCOUNT_ID>fs_cache/blocks/3264648-<BLOCK_HASH>-compactblock")")
ERROR ZCashKit: State: Error: blockRepositoryRemoveBlockClearingCache(
file://.../z-cash-kit/<WALLET_ACCOUNT_ID>fs_cache/blocks/
3262038-<BLOCK_HASH>-compactblock,
Error Domain=NSCocoaErrorDomain Code=4 "...-compactblock couldn't be removed."
UserInfo={NSUserStringVariant=(Remove), ...,
NSUnderlyingError=0x... {Error Domain=NSPOSIXErrorDomain Code=2
"No such file or directory"}})
Suspected root cause (hypothesis)
The FsBlockDb metadata references compact-block files that are missing from disk. The re-sync flow (buying ZEC while the coin is disabled → full re-sync from genesis → toggling the coin and overriding restoreHeight) seems to leave the cache in an inconsistent state, after which scan/write/remove operations all fail on missing paths. Worth investigating whether buying ZEC while the coin manager is disabled bypasses the normal sync-resume logic and resets the sync height.
Environment
Device: physical iPhone, debugged over cable via Xcode
Debug mode: off
ZCash sync ends up in a permanently failing state. The errors point to a desync between the FsBlockDb compact-block cache on disk and its metadata/database: the kit tries to scan, write metadata for, or remove block files that no longer exist on the filesystem. The failure is intermittent in the sense that a different one of the three errors below surfaces on each attempt (not all at once).
Steps to reproduce
Observed errors (one of these per attempt)
ERROR ZCashKit: State: Error: rustScanBlocks("Error while scanning blocks:
The underlying block store produced the following error: Failed to access
the file system: No such file or directory (os error 2)")
ERROR ZCashKit: State: Error: rustWriteBlocksMetadata("Failed to write block
metadata to FsBlockDb: MissingBlockPath("/var/mobile/Containers/Data/
Application/<APP_CONTAINER_UUID>/Library/Application Support/z-cash-kit/
<WALLET_ACCOUNT_ID>fs_cache/blocks/3264648-<BLOCK_HASH>-compactblock")")
ERROR ZCashKit: State: Error: blockRepositoryRemoveBlockClearingCache(
file://.../z-cash-kit/<WALLET_ACCOUNT_ID>fs_cache/blocks/
3262038-<BLOCK_HASH>-compactblock,
Error Domain=NSCocoaErrorDomain Code=4 "...-compactblock couldn't be removed."
UserInfo={NSUserStringVariant=(Remove), ...,
NSUnderlyingError=0x... {Error Domain=NSPOSIXErrorDomain Code=2
"No such file or directory"}})
Suspected root cause (hypothesis)
The FsBlockDb metadata references compact-block files that are missing from disk. The re-sync flow (buying ZEC while the coin is disabled → full re-sync from genesis → toggling the coin and overriding restoreHeight) seems to leave the cache in an inconsistent state, after which scan/write/remove operations all fail on missing paths. Worth investigating whether buying ZEC while the coin manager is disabled bypasses the normal sync-resume logic and resets the sync height.
Environment
Device: physical iPhone, debugged over cable via Xcode
Debug mode: off