diff --git a/core/src/main/java/com/google/bitcoin/core/FullPrunedBlockChain.java b/core/src/main/java/com/google/bitcoin/core/FullPrunedBlockChain.java index cb37323a..d5f4177d 100644 --- a/core/src/main/java/com/google/bitcoin/core/FullPrunedBlockChain.java +++ b/core/src/main/java/com/google/bitcoin/core/FullPrunedBlockChain.java @@ -223,12 +223,12 @@ public class FullPrunedBlockChain extends AbstractBlockChain { } // All values were already checked for being non-negative (as it is verified in Transaction.verify()) // but we check again here just for defence in depth. Transactions with zero output value are OK. - if (valueOut.signum() < 0 || valueOut.compareTo(params.MAX_MONEY) > 0) + if (valueOut.signum() < 0 || valueOut.compareTo(NetworkParameters.MAX_MONEY) > 0) throw new VerificationException("Transaction output value out of rage"); if (isCoinBase) { coinbaseValue = valueOut; } else { - if (valueIn.compareTo(valueOut) < 0 || valueIn.compareTo(params.MAX_MONEY) > 0) + if (valueIn.compareTo(valueOut) < 0 || valueIn.compareTo(NetworkParameters.MAX_MONEY) > 0) throw new VerificationException("Transaction input value out of range"); totalFees = totalFees.add(valueIn.subtract(valueOut)); } @@ -240,7 +240,7 @@ public class FullPrunedBlockChain extends AbstractBlockChain { listScriptVerificationResults.add(future); } } - if (totalFees.compareTo(params.MAX_MONEY) > 0 || block.getBlockInflation(height).add(totalFees).compareTo(coinbaseValue) < 0) + if (totalFees.compareTo(NetworkParameters.MAX_MONEY) > 0 || block.getBlockInflation(height).add(totalFees).compareTo(coinbaseValue) < 0) throw new VerificationException("Transaction fees out of range"); for (Future future : listScriptVerificationResults) { VerificationException e; @@ -345,12 +345,12 @@ public class FullPrunedBlockChain extends AbstractBlockChain { } // All values were already checked for being non-negative (as it is verified in Transaction.verify()) // but we check again here just for defence in depth. Transactions with zero output value are OK. - if (valueOut.signum() < 0 || valueOut.compareTo(params.MAX_MONEY) > 0) + if (valueOut.signum() < 0 || valueOut.compareTo(NetworkParameters.MAX_MONEY) > 0) throw new VerificationException("Transaction output value out of rage"); if (isCoinBase) { coinbaseValue = valueOut; } else { - if (valueIn.compareTo(valueOut) < 0 || valueIn.compareTo(params.MAX_MONEY) > 0) + if (valueIn.compareTo(valueOut) < 0 || valueIn.compareTo(NetworkParameters.MAX_MONEY) > 0) throw new VerificationException("Transaction input value out of range"); totalFees = totalFees.add(valueIn.subtract(valueOut)); } @@ -362,7 +362,7 @@ public class FullPrunedBlockChain extends AbstractBlockChain { listScriptVerificationResults.add(future); } } - if (totalFees.compareTo(params.MAX_MONEY) > 0 || + if (totalFees.compareTo(NetworkParameters.MAX_MONEY) > 0 || newBlock.getHeader().getBlockInflation(newBlock.getHeight()).add(totalFees).compareTo(coinbaseValue) < 0) throw new VerificationException("Transaction fees out of range"); txOutChanges = new TransactionOutputChanges(txOutsCreated, txOutsSpent); diff --git a/core/src/main/java/com/google/bitcoin/core/Transaction.java b/core/src/main/java/com/google/bitcoin/core/Transaction.java index fe2727c9..78d895af 100644 --- a/core/src/main/java/com/google/bitcoin/core/Transaction.java +++ b/core/src/main/java/com/google/bitcoin/core/Transaction.java @@ -1273,7 +1273,7 @@ public class Transaction extends ChildMessage implements Serializable { throw new VerificationException("Transaction output negative"); valueOut = valueOut.add(output.getValue()); } - if (valueOut.compareTo(params.MAX_MONEY) > 0) + if (valueOut.compareTo(NetworkParameters.MAX_MONEY) > 0) throw new VerificationException("Total transaction output value greater than possible"); if (isCoinBase()) {