diff --git a/core/src/main/java/org/bitcoinj/store/DatabaseFullPrunedBlockStore.java b/core/src/main/java/org/bitcoinj/store/DatabaseFullPrunedBlockStore.java index f3d98788..621f15eb 100644 --- a/core/src/main/java/org/bitcoinj/store/DatabaseFullPrunedBlockStore.java +++ b/core/src/main/java/org/bitcoinj/store/DatabaseFullPrunedBlockStore.java @@ -623,7 +623,7 @@ public abstract class DatabaseFullPrunedBlockStore implements FullPrunedBlockSto try { PreparedStatement s = conn.get().prepareStatement(getInsertHeadersSQL()); - // We skip the first 4 bytes because (on prodnet) the minimum target has 4 0-bytes + // We skip the first 4 bytes because (on mainnet) the minimum target has 4 0-bytes byte[] hashBytes = new byte[28]; System.arraycopy(storedBlock.getHeader().getHash().getBytes(), 4, hashBytes, 0, 28); s.setBytes(1, hashBytes); @@ -641,7 +641,7 @@ public abstract class DatabaseFullPrunedBlockStore implements FullPrunedBlockSto PreparedStatement s = conn.get().prepareStatement(getUpdateHeadersSQL()); s.setBoolean(1, true); - // We skip the first 4 bytes because (on prodnet) the minimum target has 4 0-bytes + // We skip the first 4 bytes because (on mainnet) the minimum target has 4 0-bytes byte[] hashBytes = new byte[28]; System.arraycopy(storedBlock.getHeader().getHash().getBytes(), 4, hashBytes, 0, 28); s.setBytes(2, hashBytes); @@ -664,7 +664,7 @@ public abstract class DatabaseFullPrunedBlockStore implements FullPrunedBlockSto @Override public void put(StoredBlock storedBlock, StoredUndoableBlock undoableBlock) throws BlockStoreException { maybeConnect(); - // We skip the first 4 bytes because (on prodnet) the minimum target has 4 0-bytes + // We skip the first 4 bytes because (on mainnet) the minimum target has 4 0-bytes byte[] hashBytes = new byte[28]; System.arraycopy(storedBlock.getHeader().getHash().getBytes(), 4, hashBytes, 0, 28); int height = storedBlock.getHeight(); @@ -744,7 +744,7 @@ public abstract class DatabaseFullPrunedBlockStore implements FullPrunedBlockSto try { s = conn.get() .prepareStatement(getSelectHeadersSQL()); - // We skip the first 4 bytes because (on prodnet) the minimum target has 4 0-bytes + // We skip the first 4 bytes because (on mainnet) the minimum target has 4 0-bytes byte[] hashBytes = new byte[28]; System.arraycopy(hash.getBytes(), 4, hashBytes, 0, 28); s.setBytes(1, hashBytes); @@ -800,7 +800,7 @@ public abstract class DatabaseFullPrunedBlockStore implements FullPrunedBlockSto try { s = conn.get() .prepareStatement(getSelectUndoableBlocksSQL()); - // We skip the first 4 bytes because (on prodnet) the minimum target has 4 0-bytes + // We skip the first 4 bytes because (on mainnet) the minimum target has 4 0-bytes byte[] hashBytes = new byte[28]; System.arraycopy(hash.getBytes(), 4, hashBytes, 0, 28); @@ -1256,7 +1256,7 @@ public abstract class DatabaseFullPrunedBlockStore implements FullPrunedBlockSto s.setString(1, address.toString()); ResultSet rs = s.executeQuery(); while (rs.next()) { - Coin amount = Coin.valueOf((new BigInteger(rs.getBytes(1)).longValue())); + Coin amount = Coin.valueOf(rs.getLong(1)); byte[] scriptBytes = rs.getBytes(2); int height = rs.getInt(3); TransactionOutput output = new TransactionOutput(params, null, amount, scriptBytes); diff --git a/core/src/main/java/org/bitcoinj/store/PostgresFullPrunedBlockStore.java b/core/src/main/java/org/bitcoinj/store/PostgresFullPrunedBlockStore.java index 2b53bd04..e41cdc23 100644 --- a/core/src/main/java/org/bitcoinj/store/PostgresFullPrunedBlockStore.java +++ b/core/src/main/java/org/bitcoinj/store/PostgresFullPrunedBlockStore.java @@ -167,7 +167,7 @@ public class PostgresFullPrunedBlockStore extends DatabaseFullPrunedBlockStore { @Override public void put(StoredBlock storedBlock, StoredUndoableBlock undoableBlock) throws BlockStoreException { maybeConnect(); - // We skip the first 4 bytes because (on prodnet) the minimum target has 4 0-bytes + // We skip the first 4 bytes because (on mainnet) the minimum target has 4 0-bytes byte[] hashBytes = new byte[28]; System.arraycopy(storedBlock.getHeader().getHash().getBytes(), 4, hashBytes, 0, 28); int height = storedBlock.getHeight();