Update rpc checks (#585)

* check rpc version

* update protocol version check
merge-requests/3/head
wow nero 5 years ago committed by GitHub
parent 3fe6571e7d
commit ba79bf87aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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");

Loading…
Cancel
Save