mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-01-31 07:12:17 +00: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();
|
cursor += output.getMessageSize();
|
||||||
}
|
}
|
||||||
lockTime = readUint32();
|
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;
|
Block b2 = createFakeBlock(unitTestParams, blockStore, tx2).block;
|
||||||
hash = b2.getMerkleRoot();
|
hash = b2.getMerkleRoot();
|
||||||
b2.setMerkleRoot(Sha256Hash.ZERO_HASH);
|
b2.setMerkleRoot(Sha256Hash.ZERO_HASH);
|
||||||
|
b2.solve();
|
||||||
chain.add(b2); // Broken block is accepted because its contents don't matter to us.
|
chain.add(b2); // Broken block is accepted because its contents don't matter to us.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user