bitcoinj / bitcoinj

A library for working with Bitcoin
https://bitcoinj.org
Apache License 2.0
4.98k stars 2.48k forks source link

Cannot verify block on BitcoinCash-chain - failing block is 478576 #1428

Closed frohal closed 7 years ago

frohal commented 7 years ago

org.bitcoinj.core.VerificationException: Could not verify block 000000000000000000639be19a0123a1c99d9fef89f0b8ac055a77f4ef86ae3b FilteredBlock{merkleTree=PartialMerkleTree{transactionCount=279, matchedChildBits=[-69, 90, -75, 2], hashes=[c447aefd00e90d8e49ad2836f5573abff6eb390e244802f9e56255ccd545c8f8, 87119756c5ecb0216a8cd6938ddc88abae906c9a00633436174eb26050478a0e, 991b1b8f6bc3b4b4264eee215f8e1a17632af0108bc14b66b6adc792c0ff42fc, 6e742522f033c698e528655702ad29f3aaa9e9aa4c209216b63639ab6ddb8ed3, 5bac58dd4257ead306abfb6f965a99b2a7bb86553d01cc399fe1ca67ab5337bf, 0cff151d38fb16e02ce671cffde6ea775671822fa26034c00b98ed184411af2a, 86f3365e916c10a16b429aa459f1ae863a0d3d61fcddc238ccdbc276f56f0842, cc41993c1d273cc71ef8bfb92f4c6cfa3f2f7f8f577344c69ab417ea59082ad2, db4674280a894b97d119b9bff785ed12f41e92c4247b4064bc393a31dedfd103, ea6869b616d9809608fc617c810903dfeaf2b1d1d8367fccd927e95a4ab69302, 5d4c5c29d870ab0ea8ac245133fd4eb3f2102335b9677f3800dec64c82602762, e6b32bdb966399b60b4b36bd177ae71eed5edd8152a2e01d5f9dda91cb4b308e, bdd38841eac729a551246f99e1b06660d5c32787e60f2583089f70c4004a0fda, de8420436b2ca547277da3ed7423b77e3ec19bd3412127608fb65198af7c4a17, 860cf7e0cfab3a99e5dd58a115e3973f58293a4726fd55d8b672d322527237d0]}, header= block: hash: 000000000000000000639be19a0123a1c99d9fef89f0b8ac055a77f4ef86ae3b version: 536870912 (BIP34, BIP66, BIP65) previous block: 000000000000000001416af072f8989829f4c60a1a9658e1cec08411798e4ffa merkle root: 7503e5b76cfac302b28db12274d869b2ef683405ce1197fe4bb7e80344d3c63e time: 1501730885 (2017-08-03T03:28:05Z) difficulty target (nBits): 402757890 nonce: 518481854 } at org.bitcoinj.core.AbstractBlockChain.add(AbstractBlockChain.java:392) at org.bitcoinj.core.BlockChain.add(BlockChain.java:166) at org.bitcoinj.core.Peer.endFilteredBlock(Peer.java:1081) at org.bitcoinj.core.Peer.processMessage(Peer.java:470) at org.bitcoinj.core.PeerSocketHandler.receiveBytes(PeerSocketHandler.java:182) at org.bitcoinj.net.ConnectionHandler.handleKey(ConnectionHandler.java:223) at org.bitcoinj.net.NioClientManager.handleKey(NioClientManager.java:86) at org.bitcoinj.net.NioClientManager.run(NioClientManager.java:122) at com.google.common.util.concurrent.AbstractExecutionThreadService$1$2.run(AbstractExecutionThreadService.java:66) at com.google.common.util.concurrent.Callables$4.run(Callables.java:122) at org.bitcoinj.utils.ContextPropagatingThreadFactory$1.run(ContextPropagatingThreadFactory.java:51) at java.lang.Thread.run(Thread.java:745) Caused by: org.bitcoinj.core.VerificationException: Unexpected change in difficulty at height 478576: 18019902 vs 18014735 at org.bitcoinj.params.AbstractBitcoinNetParams.checkDifficultyTransitions(AbstractBitcoinNetParams.java:90) at org.bitcoinj.core.AbstractBlockChain.add(AbstractBlockChain.java:488) at org.bitcoinj.core.AbstractBlockChain.add(AbstractBlockChain.java:381) ... 11 more

schildbach commented 7 years ago

That's expected. Bitcoin Cash has a broken difficulty adjustment.

frohal commented 7 years ago

So bitcoinJ is not going to support the Bitcoin Cash - chain at all ?

schildbach commented 7 years ago

We decided a long time ago to only support the Bitcoin blockchain and instead make it easy to fork bitcoinj and adapt it to different chains. This has been done in the form of lightcoinj, dogecoinj and countless others. So the way forward for Bitcoin Cash is fork a 'bitcoincashj'.