Bitcoinj fails with NegativeArraySizeException when iteration over the blocks
Bitcoinj fails with NegativeArraySizeException when iteration over the blocks I'm iterating over the blocks of some block files generated by bitcoin-core. The following code works without any problem for the first 900 block files. Context.getOrCreate(MainNetParams.get()); BlockFileLoader blockFileLoader = new BlockFileLoader( MainNetParams.get(), Arrays.asList(blockFile.toFile()) ); while(blockFileLoader.hasNext()){ System.out.println(blockFileLoader.next().getHash()); } But then it fails at a specific block file with this Exception: Exception in thread "main" java.lang.NegativeArraySizeException at org.bitcoinj.core.Message.readBytes(Message.java:334) at org.bitcoinj.core.TransactionOutput.parse(TransactionOutput.java:163) at org.bitcoinj.core.Message.<init>(Message.java:96) at org.bitcoinj.core.Message.<init>(Message.java:128) at org.bitcoinj.core.ChildMessage.<init>(ChildMessage.java:57) at org.bitcoinj.core....