Background
When running the OKC main network node, the code version is inconsistent or the code is not compiled with make mainnet (if it is a test network: make testnet), which may cause the node status data to be damaged. This post provides a method to repair the status data.
Question
The status data of the running node is damaged, and the following error is reported
- wrong Block.Header.AppHash
panic: Failed to process committed block (5355801:EDB99CC2643279770CD3A06CDA5169BE5F3A8943D5644A5A6A147A29AB598372): wrong Block.Header.AppHash. Expected 3F21CC5D5F6B91AED7D7FFD87D809218AF8B996029896BEF033419C779603214, got F674BA0BDB959E9288AB52F574AB4037FF5CB28FAF28FA442640D867A4E232ED
- wrong Block.Header.LastResultsHash
error during handshake: error on replay: wrong Block.Header.LastResultsHash. Expected DBC62DB6E38E211BFCF82A96CCCEE5C98C42AC0DD10D733E386C096ACF58EE22, got F0AF8B8E9B498F68631DF986F69BD41A9F97A3FD436CAD709C97A470AD28EDCA
- Lost state data
failed to load acc Store: wanted to load target 15439037 but only found up to 15439021
Solution
Download and compile the latest release version code
export EXCHAIND_PATH=~/.okexchaind #(If your --home directory is not ~/.okexchaind, please specify your own --home directory)
cd ${EXCHAIND_PATH}
rm -rf exchange
git clone -b latest_version https://github.com/okx/exchain.git # latest_version can be viewed through the link https://github.com/okx/exchain/releases/latest
cd exchange
make mainnet # must be used (if it is a testnet: make testnet)
Use the exchaind repair-state command to repair the state data. The repair command is as follows:
exchaind repair-state --home ${EXCHAIND_PATH} --db_backend=rocksdb
Remarks: If a similar error occurs on the command line: wanted to load target 15417699 but only found up to 15417600, repair the parameter with --start-height=15417500 and execute it again
Restart the node with the repaired data and observe whether the block is synchronized normally