Hollow.Quincy
Hollow.Quincy

Reputation: 577

bitcoinj-core failed to parse blockchain

I downloaded bitcoin synchronization: https://bitcoin.org/bin/bitcoin-core-0.21.0/bitcoin-0.21.0-x86_64-linux-gnu.tar.gz

In Java I use the newest bitcoinj-core:

    <dependency>
      <groupId>org.bitcoinj</groupId>
      <artifactId>bitcoinj-core</artifactId>
      <version>0.15.10</version>
    </dependency>

I have a code:

 List<File> list = new ArrayList<>();
    list.add(new File("/bitcoin/src/test/resources/rev00001.dat"));
    MainNetParams params = MainNetParams.get();
    Context context = new Context(params);
    BlockFileLoader bfl = new BlockFileLoader(params, list);

    for (Block block : bfl) {
      System.out.println(block.getHashAsString());
    }

I have the exception:

java.lang.RuntimeException: unexpected problem with block in /bitcoin/src/test/resources/rev00001.dat
...
Caused by: java.lang.NegativeArraySizeException: -989849719
    at org.bitcoinj.core.Message.readBytes(Message.java:337)

Upvotes: 0

Views: 130

Answers (1)

Vadym Vikulin
Vadym Vikulin

Reputation: 56

Upgrade bitcoinj with latest version: this is known defect.

Upvotes: 0

Related Questions