From 615c18f77f52a83651a261d76b16c6e7045978cf Mon Sep 17 00:00:00 2001 From: Luca Moser Date: Fri, 30 Aug 2019 11:28:46 +0200 Subject: [PATCH 1/2] removes redundant break statement --- .../com/iota/iri/service/ledger/impl/LedgerServiceImpl.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/java/com/iota/iri/service/ledger/impl/LedgerServiceImpl.java b/src/main/java/com/iota/iri/service/ledger/impl/LedgerServiceImpl.java index a034e30d4e..0852d1d9a4 100644 --- a/src/main/java/com/iota/iri/service/ledger/impl/LedgerServiceImpl.java +++ b/src/main/java/com/iota/iri/service/ledger/impl/LedgerServiceImpl.java @@ -217,8 +217,6 @@ public Map generateBalanceDiff(Set visitedTransactions, Hash s : Math.addExact(value, bundleTransactionViewModel.value())); } } - - break; } } From ba0065fe8ab9a27b84e52f8bac29af29a40fc4af Mon Sep 17 00:00:00 2001 From: Luca Moser Date: Fri, 30 Aug 2019 11:54:15 +0200 Subject: [PATCH 2/2] remove redundant check whether first tx of bndl equals current tvm --- .../iri/service/ledger/impl/LedgerServiceImpl.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/iota/iri/service/ledger/impl/LedgerServiceImpl.java b/src/main/java/com/iota/iri/service/ledger/impl/LedgerServiceImpl.java index 0852d1d9a4..aa0e773502 100644 --- a/src/main/java/com/iota/iri/service/ledger/impl/LedgerServiceImpl.java +++ b/src/main/java/com/iota/iri/service/ledger/impl/LedgerServiceImpl.java @@ -205,17 +205,15 @@ public Map generateBalanceDiff(Set visitedTransactions, Hash s break; } - if (bundleTransactions.get(0).getHash().equals(transactionViewModel.getHash())) { - for (final TransactionViewModel bundleTransactionViewModel : bundleTransactions) { + for (final TransactionViewModel bundleTransactionViewModel : bundleTransactions) { - if (bundleTransactionViewModel.value() != 0 && countedTx.add(bundleTransactionViewModel.getHash())) { + if (bundleTransactionViewModel.value() != 0 && countedTx.add(bundleTransactionViewModel.getHash())) { - final Hash address = bundleTransactionViewModel.getAddressHash(); - final Long value = state.get(address); - state.put(address, value == null ? bundleTransactionViewModel.value() - : Math.addExact(value, bundleTransactionViewModel.value())); - } + final Hash address = bundleTransactionViewModel.getAddressHash(); + final Long value = state.get(address); + state.put(address, value == null ? bundleTransactionViewModel.value() + : Math.addExact(value, bundleTransactionViewModel.value())); } } }