mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2025-01-19 05:33:44 +01:00
Don't pre-calculate the hash in the Transaction parse code. Speeds up processing of large blocks with no relevant transactions.
This commit is contained in:
parent
53d5d7572b
commit
ea8cbd7465
@ -232,9 +232,6 @@ public class Transaction extends Message implements Serializable {
|
||||
cursor += output.getMessageSize();
|
||||
}
|
||||
lockTime = readUint32();
|
||||
|
||||
// Store a hash, it may come in useful later (want to avoid reserialization costs).
|
||||
hash = new Sha256Hash(reverseBytes(doubleDigest(bytes, offset, cursor - offset)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -106,6 +106,7 @@ public class BlockChainTest {
|
||||
Block b2 = createFakeBlock(unitTestParams, blockStore, tx2).block;
|
||||
hash = b2.getMerkleRoot();
|
||||
b2.setMerkleRoot(Sha256Hash.ZERO_HASH);
|
||||
b2.solve();
|
||||
chain.add(b2); // Broken block is accepted because its contents don't matter to us.
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user