HorizenOfficial / zen_archived

TLS integration and more!
https://zensystem.io
Other
128 stars 44 forks source link

Block Chain database corrupts requiring reindex #120

Closed psyraxaus closed 6 years ago

psyraxaus commented 6 years ago

Describe the issue

Blockchain Database corrupts after graceful shut down of the swing wallet on my mac

Can you reliably reproduce the issue?

If so, please list the steps to reproduce below:

  1. Took backup of zen directory on my Mac
  2. Allowed swing wallet/zend to sync to 100%
  3. Gracefully shut down the wallet.
  4. 12 hours later restarted the swing wallet and then immediately the error was displayed where I needed to reindex the blockchain - ": Error loading block database. Please restart with -reindex to recover." debug.log information regarding the failure is pasted below
  5. Attempted to restart using --rescan, which failed with same error.
  6. Renamed current zen directory to zen.old and replaced with the backup Zen directory
  7. Restarted the Swing Wallet and allowed to sync a few thousand blocks since the last back
  8. Gracefully shutdown
  9. Took a new backup of zen director at block 250851
  10. restarted swing wallet - Error occurred

Expected behaviour

Wallet should load without requiring reindex

Actual behaviour + errors

Error: A general unexpected critical error has occurred: error: couldn't connect to server: unknown (code -1) (make sure server is running and you are connecting to the correct RPC port) See the console output for me detailed error information!

Detailed debug.log information below.

The version of Zen you were using:

Zen Daemon version v2.0.10

Machine specs:

Any extra information that might be useful in the debugging process.

I am not sure if it is related but the two blocks (252205 and 250420) that the error occurred on for me were both mined by miningspeed

Initial error entry from ~/Library/Application Support/Zen/debug.log:

2018-02-18 01:20:43 ERROR: CheckProofOfWork(): hash doesn't match nBits 2018-02-18 01:20:43 ERROR: LoadBlockIndex(): CheckProofOfWork failed: CBlockIndex(pprev=0x10489f0e0, nHeight=252205, merkle=d1706cba2a039d72bcead545a30a4e5f42b895cbb41dc531eceab4d6a26acce6, hashBlock=a7d89c391ce4e37859595c69f443355d2ae11195bdc8d705366e32d84565d935)

Second round error entry from ~/Library/Application Support/Zen/debug.log

2018-02-18 02:19:15 ERROR: CheckProofOfWork(): hash doesn't match nBits 2018-02-18 02:19:15 ERROR: LoadBlockIndex(): CheckProofOfWork failed: CBlockIndex(pprev=0x113835700, nHeight=250420, merkle=98bde01aca5d15ab43bc9e55f7aaf42db74a290446a96e2dde8493c5706a2182, hashBlock=4e3fe4051aa73d5a3373415cc17c7687d14743d12693d73c70d700b308e88a0c) 2018-02-18 02:19:15 : Error loading block database. Please restart with -reindex to recover.

Do you have a back up of ~/.zen directory and/or take a VM snapshot?

I have multiple backups of the zen directory on my Mac

psyraxaus commented 6 years ago

Just synced 100% (up to block 259396 at time of testing) gracefully shutdown and backed up the zen directory on my mac. Started the wallet again and received the following:

2018-02-18 07:51:15 ERROR: CheckProofOfWork(): hash doesn't match nBits 2018-02-18 07:51:15 ERROR: LoadBlockIndex(): CheckProofOfWork failed: CBlockIndex(pprev=0x10e68ce50, nHeight=252205, merkle=d1706cba2a039d72bcead545a30a4e5f42b895cbb41dc531eceab4d6a26acce6, hashBlock=a7d89c391ce4e37859595c69f443355d2ae11195bdc8d705366e32d84565d935) 2018-02-18 07:51:15 : Error loading block database. Please restart with -reindex to recover.

cronicc commented 6 years ago

A fix for this is here, a new zen release with it included is being worked on.