mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2025-02-24 22:58:32 +01:00
Bug fix: The database access code was not updated on field value type change.
This commit is contained in:
parent
9004166122
commit
eed5f22550
2 changed files with 7 additions and 7 deletions
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Add table
Reference in a new issue