From ba79bf87aa5e7b73951cdfa2ae33551b61e34ece Mon Sep 17 00:00:00 2001 From: m2049r Date: Sat, 11 May 2019 21:15:35 +0200 Subject: [PATCH] Update rpc checks (#585) * check rpc version * update protocol version check --- app/src/main/java/com/m2049r/xmrwallet/data/NodeInfo.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/m2049r/xmrwallet/data/NodeInfo.java b/app/src/main/java/com/m2049r/xmrwallet/data/NodeInfo.java index bb2324b..94c7fa2 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/data/NodeInfo.java +++ b/app/src/main/java/com/m2049r/xmrwallet/data/NodeInfo.java @@ -46,7 +46,8 @@ import okhttp3.ResponseBody; import timber.log.Timber; public class NodeInfo extends Node { - final static public int MIN_MAJOR_VERSION = 9; + final static public int MIN_MAJOR_VERSION = 11; + final static public String RPC_VERSION = "2.0"; private long height = 0; private long timestamp = 0; @@ -231,6 +232,9 @@ public class NodeInfo extends Node { if ((respBody != null) && (respBody.contentLength() < 2000)) { // sanity check final JSONObject json = new JSONObject( respBody.string()); + String rpcVersion = json.getString("jsonrpc"); + if (!RPC_VERSION.equals(rpcVersion)) + return false; final JSONObject header = json.getJSONObject( "result").getJSONObject("block_header"); height = header.getLong("height");