From 8c0833a9ba723d8319140561b6cd7df879f8a319 Mon Sep 17 00:00:00 2001 From: AZ Date: Tue, 3 Jan 2017 10:56:58 +0100 Subject: [PATCH] ignore errors from getbundle --- src/main/java/jota/IotaAPIProxy.java | 27 ++++++++++++++++----------- src/main/java/jota/utils/Signing.java | 1 - 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/main/java/jota/IotaAPIProxy.java b/src/main/java/jota/IotaAPIProxy.java index c5f65ad..d550e44 100644 --- a/src/main/java/jota/IotaAPIProxy.java +++ b/src/main/java/jota/IotaAPIProxy.java @@ -314,20 +314,25 @@ public class IotaAPIProxy { if (gisr == null || gisr.getStates() == null || gisr.getStates().length == 0) return null; } for (String trx : tailTxArray) { - - GetBundleResponse bundleResponse = getBundle(trx); - // TODO: review possibly dirty WA - if (bundleResponse == null) continue; - Bundle gbr = new Bundle(bundleResponse.getTransactions(), bundleResponse.getTransactions().size()); - if (gbr != null && gbr.getTransactions() != null) { - if (inclusionStates) { - boolean thisInclusion = gisr.getStates()[Arrays.asList(tailTxArray).indexOf(trx)]; - for (Transaction t : gbr.getTransactions()) { - t.setPersistence(thisInclusion); + try { + GetBundleResponse bundleResponse = getBundle(trx); + // TODO: review possibly dirty WA + if (bundleResponse == null) continue; + Bundle gbr = new Bundle(bundleResponse.getTransactions(), bundleResponse.getTransactions().size()); + if (gbr != null && gbr.getTransactions() != null) { + if (inclusionStates) { + boolean thisInclusion = gisr.getStates()[Arrays.asList(tailTxArray).indexOf(trx)]; + for (Transaction t : gbr.getTransactions()) { + t.setPersistence(thisInclusion); + } } + finalBundles.add(gbr); } - finalBundles.add(gbr); + // If error returned from getBundle, simply ignore it because the bundle was most likely incorrect + }catch(Exception e){ + log.warn("GetBundleError: ",e); } + } Collections.sort(finalBundles, new Comparator() { diff --git a/src/main/java/jota/utils/Signing.java b/src/main/java/jota/utils/Signing.java index c6110fd..b984a2b 100644 --- a/src/main/java/jota/utils/Signing.java +++ b/src/main/java/jota/utils/Signing.java @@ -163,7 +163,6 @@ public class Signing { digests[i * 243 + j] = digestBuffer[j]; } } - //System.out.println(Arrays.toString(digests).replaceAll("\\s+","")); String address = Converter.trytes(address(digests)); return (expectedAddress.equals(address));