From 84c2957ecf64e8c6518e5f5cc8c486f51c27f309 Mon Sep 17 00:00:00 2001 From: Bruno Volpato Date: Tue, 13 Aug 2019 15:19:02 -0400 Subject: [PATCH 1/2] fix: make verify workable --- src/main/java/com/eternitywall/http/Request.java | 3 ++- src/main/java/com/eternitywall/ots/MultiInsight.java | 6 +++--- src/main/java/com/eternitywall/ots/OtsCli.java | 3 +-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/eternitywall/http/Request.java b/src/main/java/com/eternitywall/http/Request.java index 63328ca..4c68385 100644 --- a/src/main/java/com/eternitywall/http/Request.java +++ b/src/main/java/com/eternitywall/http/Request.java @@ -55,7 +55,8 @@ public Response call() throws Exception { HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection(); httpURLConnection.setReadTimeout(10000); httpURLConnection.setConnectTimeout(10000); - httpURLConnection.setRequestProperty("User-Agent", "java"); + httpURLConnection.setRequestProperty("User-Agent", "OpenTimestamps/1.17"); + httpURLConnection.setRequestProperty("Accept", "application/json"); if (headers != null) { for (Map.Entry entry : headers.entrySet()) { diff --git a/src/main/java/com/eternitywall/ots/MultiInsight.java b/src/main/java/com/eternitywall/ots/MultiInsight.java index a3af5c6..e8bb42b 100644 --- a/src/main/java/com/eternitywall/ots/MultiInsight.java +++ b/src/main/java/com/eternitywall/ots/MultiInsight.java @@ -35,7 +35,7 @@ public MultiInsight(String chain) throws Exception { if (chain.equals("bitcoin")) { //insightUrls.add("https://search.bitaccess.co/insight-api"); //insightUrls.add("https://www.localbitcoinschain.com/api"); - //insightUrls.add("https://insight.bitpay.com/api"); + insightUrls.add("https://insight.bitpay.com/api"); //insightUrls.add("https://finney.calendar.eternitywall.com/insight-api"); insightUrls.add("https://btc-bitcore1.trezor.io/api"); //insightUrls.add("https://btc-bitcore4.trezor.io/api"); @@ -79,7 +79,7 @@ public BlockHeader block(String hash) throws Exception { JSONObject jsonObject = take.getJson(); try { - String merkleroot = jsonObject.getString("merkleroot"); + String merkleroot = jsonObject.has("merkleroot") ? jsonObject.getString("merkleroot") : jsonObject.getString("merkleRoot"); String time = String.valueOf(jsonObject.getInt("time")); BlockHeader blockHeader = new BlockHeader(); blockHeader.setMerkleroot(merkleroot); @@ -93,7 +93,7 @@ public BlockHeader block(String hash) throws Exception { results.add(blockHeader); } catch (JSONException e) { - log.warning("Cannot parse merkleroot from body: " + jsonObject); + log.warning("Cannot parse merkleroot from body: " + jsonObject + ": " + e.getMessage()); } } } diff --git a/src/main/java/com/eternitywall/ots/OtsCli.java b/src/main/java/com/eternitywall/ots/OtsCli.java index 5e6b645..06ba670 100644 --- a/src/main/java/com/eternitywall/ots/OtsCli.java +++ b/src/main/java/com/eternitywall/ots/OtsCli.java @@ -355,8 +355,7 @@ public static void verify(String argsOts, Hash hash, String argsFile) { System.out.println("Success! " + Utils.toUpperFirstLetter(chain) + " " + entry.getValue().toString()); } } catch (Exception e) { - System.out.println(e.getMessage()); - + e.printStackTrace(); return; } } catch (Exception e) { From b362be0c53b446b5274d21d91bfe35c63afd7437 Mon Sep 17 00:00:00 2001 From: Bruno Volpato Date: Tue, 13 Aug 2019 15:25:27 -0400 Subject: [PATCH 2/2] fix: build, use openjdk8 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index c30ad5a..ea365fa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: java jdk: - - oraclejdk8 + - openjdk8 notifications: slack: eternitywall:etqKsfod1e0lcsOFby1npMh6g