FullPrunedBlockChain: Remove use of deprecated Block::getBlockInflation
package org.bitcoinj.core;
+import org.bitcoinj.params.AbstractBitcoinNetParams;
import org.bitcoinj.script.Script;
import org.bitcoinj.script.Script.VerifyFlag;
import org.bitcoinj.script.ScriptPattern;
@@ -317,7 +318,7 @@ public class FullPrunedBlockChain extends AbstractBlockChain {
listScriptVerificationResults.add(future);
}
}
- if (totalFees.compareTo(params.getMaxMoney()) > 0 || block.getBlockInflation(height).add(totalFees).compareTo(coinbaseValue) < 0)
+ if (totalFees.compareTo(params.getMaxMoney()) > 0 || getBlockInflation(height).add(totalFees).compareTo(coinbaseValue) < 0)
throw new VerificationException("Transaction fees out of range");
for (Future<VerificationException> future : listScriptVerificationResults) {
VerificationException e;
@@ -444,8 +445,7 @@ public class FullPrunedBlockChain extends AbstractBlockChain {
listScriptVerificationResults.add(future);
}
}
- if (totalFees.compareTo(params.getMaxMoney()) > 0 ||
- newBlock.getHeader().getBlockInflation(newBlock.getHeight()).add(totalFees).compareTo(coinbaseValue) < 0)
+ if (totalFees.compareTo(params.getMaxMoney()) > 0 || getBlockInflation(newBlock.getHeight()).add(totalFees).compareTo(coinbaseValue) < 0)
throw new VerificationException("Transaction fees out of range");
txOutChanges = new TransactionOutputChanges(txOutsCreated, txOutsSpent);
for (Future<VerificationException> future : listScriptVerificationResults) {
@@ -521,4 +521,8 @@ public class FullPrunedBlockChain extends AbstractBlockChain {
checkState(lock.isHeldByCurrentThread());
return blockStore.getOnceUndoableStoredBlock(hash);
}
+
+ private Coin getBlockInflation(int height) {
+ return ((AbstractBitcoinNetParams) params).getBlockInflation(height);
+ }
}
