Wallet: Remove superfluous assignments.

This commit is contained in:
Andreas Schildbach
2016-02-29 19:22:20 +01:00
parent 98bee183b6
commit 843db1dda3

View File

@@ -4164,8 +4164,7 @@ public class Wallet extends BaseTaggableObject
TransactionOutput bestChangeOutput = null; TransactionOutput bestChangeOutput = null;
if (!req.emptyWallet) { if (!req.emptyWallet) {
// This can throw InsufficientMoneyException. // This can throw InsufficientMoneyException.
FeeCalculation feeCalculation; FeeCalculation feeCalculation = calculateFee(req, value, originalInputs, needAtLeastReferenceFee, candidates);
feeCalculation = calculateFee(req, value, originalInputs, needAtLeastReferenceFee, candidates);
bestCoinSelection = feeCalculation.bestCoinSelection; bestCoinSelection = feeCalculation.bestCoinSelection;
bestChangeOutput = feeCalculation.bestChangeOutput; bestChangeOutput = feeCalculation.bestChangeOutput;
} else { } else {
@@ -5021,7 +5020,6 @@ public class Wallet extends BaseTaggableObject
public FeeCalculation calculateFee(SendRequest req, Coin value, List<TransactionInput> originalInputs, public FeeCalculation calculateFee(SendRequest req, Coin value, List<TransactionInput> originalInputs,
boolean needAtLeastReferenceFee, List<TransactionOutput> candidates) throws InsufficientMoneyException { boolean needAtLeastReferenceFee, List<TransactionOutput> candidates) throws InsufficientMoneyException {
checkState(lock.isHeldByCurrentThread()); checkState(lock.isHeldByCurrentThread());
FeeCalculation result = new FeeCalculation();
// There are 3 possibilities for what adding change might do: // There are 3 possibilities for what adding change might do:
// 1) No effect // 1) No effect
// 2) Causes increase in fee (change < 0.01 COINS) // 2) Causes increase in fee (change < 0.01 COINS)
@@ -5174,8 +5172,7 @@ public class Wallet extends BaseTaggableObject
} }
Coin lowestFee = null; Coin lowestFee = null;
result.bestCoinSelection = null; FeeCalculation result = new FeeCalculation();
result.bestChangeOutput = null;
if (selection1 != null) { if (selection1 != null) {
if (selection1Change != null) if (selection1Change != null)
lowestFee = selection1.valueGathered.subtract(selection1Change.getValue()); lowestFee = selection1.valueGathered.subtract(selection1Change.getValue());