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:
Mike Hearn 2011-07-10 17:38:18 +00:00
parent 53d5d7572b
commit ea8cbd7465
2 changed files with 1 additions and 3 deletions

View File

@ -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)));
}
/**

View File

@ -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.
}