Skip to content

Commit

Permalink
fix: make verify workable
Browse files Browse the repository at this point in the history
  • Loading branch information
bvolpato committed Aug 13, 2019
1 parent 6a6358f commit 84c2957
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/main/java/com/eternitywall/http/Request.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, String> entry : headers.entrySet()) {
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/eternitywall/ots/MultiInsight.java
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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);
Expand All @@ -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());
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/com/eternitywall/ots/OtsCli.java
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 84c2957

Please sign in to comment.