Bitcoin-ABC / bitcoin-abc

Bitcoin ABC develops node software and infrastructure for the eCash project. This a mirror of the official Bitcoin-ABC repository. Please see README.md
https://reviews.bitcoinabc.org
MIT License
1.24k stars 779 forks source link

RPC calls fail with error Safe mode: Warning: We do not appear to fully agree with our peers! You may need to upgrade, or other nodes may need to upgrade. #59

Closed c0deright closed 6 years ago

c0deright commented 7 years ago

Describe the issue

Client was at block height 478583 and received newest block 478584, then logs error and RPC calls like getbalance fail.

Can you reliably reproduce the issue?

If so, please list the steps to reproduce below:

  1. Run bitcoin-abc node until the error CheckForkWarningConditions: Warning: Found invalid chain at least ~6 blocks longer than our best chain. Chain state database corruption likely. is logged to debug.log
  2. Run bitcoin-cli getbalance

Expected behaviour

balance is returned

Actual behaviour

Output:

error code: -2
error message:
Safe mode: Warning: We do not appear to fully agree with our peers! You may need to upgrade, or other nodes may need to upgrade.

What version of bitcoin-core are you using?

0.14.6 compiled on Ubuntu 16.04 LTS

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

2017-08-03 08:54:01 addcon thread start
2017-08-03 08:54:01 net thread start
2017-08-03 08:54:01 receive version message: /Bitcoin ABC:0.14.6(EB8.0)/: version 70015, blocks=478583, us=[::]:0, peer=0, peeraddr=<IP OF PROXY>:8333
2017-08-03 08:54:02 Imported mempool transactions from disk: 366 successes, 0 failed, 0 expired
2017-08-03 09:06:35 UpdateTip: new best=000000000000000002d841cbdff1aa150be40e9025127681e72ea36becfa9cc0 height=478584 version=0x20000000 log2_work=86.862281 tx=243298462 date='2017-08-03 09:06:24' progress=1.000000 cache=27.9MiB(2794tx) warning='75 of last 100 blocks have unexpected version'
2017-08-03 09:06:35 CheckForkWarningConditions: Warning: Found invalid chain at least ~6 blocks longer than our best chain.
Chain state database corruption likely.
c0deright commented 7 years ago

Workaround: Restart bitcoin-abc. But that's a really windows-like workaround I don't like.

c0deright commented 7 years ago

Some sources say that chain state database corruption is likely the result of faulty hardware. But the machine is running on AWS.

Nevertheless I just replaced ~/.bitcoin from another, unaffected node. After that, no such errors anymore when a new block is downloaded.

I'm closing this - might have really been a corruption of the chainstate.

cryptoapi commented 7 years ago

As temporary solution, you can change -

https://github.com/Bitcoin-ABC/bitcoin-abc/blob/master/src/validation.cpp#L1163

From if (pindexBestForkTip || (pindexBestInvalid && pindexBestInvalid->nChainWork > chainActive.Tip()->nChainWork + (GetBlockProof(*chainActive.Tip()) * 6))) {

To if (pindexBestForkTip)

  1. Change also -

https://github.com/Bitcoin-ABC/bitcoin-abc/blob/master/src/net.h#L65 MAX_OUTBOUND_CONNECTIONS = 100; MAX_ADDNODE_CONNECTIONS = 100;

  1. Change default directory - https://github.com/Bitcoin-ABC/bitcoin-abc/blob/master/src/util.cpp#L470

return GetSpecialFolderPath(CSIDL_APPDATA) / "BitcoinCash"; ... return pathRet / ".bitcoincash";

recompile it .

And add in bitcoin.conf

addnode=13.126.32.103:8333 addnode=47.94.56.232:8333 addnode=144.76.220.17:9090 addnode=39.108.71.254:8333 addnode=52.63.175.61:8333 addnode=97.113.45.103:8333 addnode=71.127.43.68:8333 addnode=52.77.223.113:8333 addnode=51.15.78.11:8333 addnode=5.135.180.61:8333 addnode=46.233.43.155:8333 addnode=13.210.30.22:8333 addnode=176.24.198.205:8334 addnode=69.55.64.221:8333 addnode=47.91.197.178:8333 addnode=72.190.79.138:8333 addnode=45.33.14.27:8333 addnode=13.55.131.240:8333 addnode=76.118.98.204:8333 addnode=35.154.149.128:8333 addnode=52.221.227.157:8333 addnode=54.179.133.79:8333 addnode=83.163.223.145:8333 addnode=80.216.4.252:8333 addnode=71.93.206.181:8333 addnode=147.91.82.116:8333 addnode=188.68.38.210:8333 addnode=100.4.108.100:8333 addnode=98.206.255.202:8333 addnode=13.126.155.63:8333 addnode=122.228.96.58:8333 addnode=178.21.118.33:8333 addnode=39.108.100.122:8333 addnode=47.94.57.128:8333 addnode=47.94.57.121:8333 addnode=47.94.45.184:8333 addnode=47.93.120.133:8333 addnode=47.94.47.152:8333 addnode=39.108.107.120:8333 addnode=47.94.57.156:8333 addnode=68.11.92.58:8333 addnode=54.66.222.15:8333 addnode=34.253.24.13:8333 addnode=163.172.4.66:8333 addnode=108.61.205.173:8333 addnode=54.238.171.233:8333 addnode=34.227.47.255:8333 addnode=69.172.174.21:8333

rubensayshi commented 7 years ago

having same issue, looks to me like my node is still receiving occasional blocks from BTC nodes and as a result decides that it needs to jump into safe mode.

@c0deright could you reopen?

ftrader commented 7 years ago

I'm in favor of removing the (pindexBestInvalid && pindexBestInvalid->nChainWork > chainActive.Tip()->nChainWork + (GetBlockProof(*chainActive.Tip()) * 6)) condition .

Is there a valid rationale for disabling operation based on the presence of some other invalid chain?

c0deright commented 6 years ago

Issue never came up again, closing.