0

I have a private multi-node blockchain. Because of Nodeos failure, it stops with the dirty flag error. I restart it with the --hard-replay-blockchain, the blocks start replaying. Here, by mistake, I run --hard-replay-blockchain again. Two replay operations were ongoing. So, I stop the script and start again. Now I am getting an error,

error 2021-05-18T03:13:16.399 nodeos    main.cpp:125                  main                 ] 3020000 fork_database_exception: Fork database exception
fork database head (17411000) is inconsistent with state (12367000)
    {"db":12367000,"head":17411000}
    nodeos  controller.cpp:666 init

    {}
    nodeos  chain_plugin.cpp:1112 plugin_startup

This is a genesis node producing blocks. I have other p2p nodes (with the same genesis.json) receiving blocks from genesis. Please guide, how would I solve this? I don't want to delete the blocks and transactions. Or if I clear blocks files or data from the genesis node, how can I sync / restore them with other peers.

1

In your case it sounds like you have 3 servers with the same set of blocks. You could manually shutdown one of the 2 working servers and copy all the blocks and state to the non-working server.

Best way to copy is to create a tar archive, copy the archive, then restore it.

tar --sparse -cf mybackup.tar [insert location of nodeos blocks and state]

Also suggest to make regular backups in a similar fashion. Always stop nodeos before running the backup.

1
  • I need your suggestion. If I have regular backup daily for nodeos blocks, and I get a dirty flag error. So, how can I avoid hard replay? replacing the current blocks with the latest backup and running nodeos normally? – Varsh Jul 7 at 3:41
0

Since you have 2 servers in sync, you could remove all the nodeos state from the server that is corrupted and sync the blocks back from the properly working nodes.

Remove all the nodeos blocks and state, and start nodeos with just the genesis.

If in doubt make a backup of your blocks and state first before erasing so you can recover if something goes wrong.

1
  • This solution can work if the syncing nodes produce as well as receive blocks. In my case, only the server which gets corrupted was producing blocks and others were receiving. – Varsh Jun 2 at 3:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.