Skip to content

Commit

Permalink
Merge pull request opentimestamps#35 from brunocvcunha/master
Browse files Browse the repository at this point in the history
fix: make verify workable
  • Loading branch information
RCasatta authored Aug 16, 2019
2 parents 6a6358f + b362be0 commit 3856b85
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
language: java
jdk:
- oraclejdk8
- openjdk8
notifications:
slack: eternitywall:etqKsfod1e0lcsOFby1npMh6g
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 3856b85

Please sign in to comment.