3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-02-07 06:44:16 +00:00

Make a block with no txn a VerificationException, not Precondition

This commit is contained in:
Matt Corallo 2012-08-29 22:05:57 -04:00 committed by Mike Hearn
parent dfebcc83ab
commit 1cbd5c07b4

View File

@ -678,7 +678,8 @@ public class Block extends Message {
// an invalid block, but if we didn't validate this then an untrusted man-in-the-middle could obtain the next
// valid block from the network and simply replace the transactions in it with their own fictional
// transactions that reference spent or non-existant inputs.
Preconditions.checkState(!transactions.isEmpty());
if (transactions.isEmpty())
throw new VerificationException("Block had no transactions");
maybeParseTransactions();
checkTransactions();
checkMerkleRoot();