mirror of https://github.com/m2049r/xmrwallet.git
Update rpc checks (#585)
* check rpc version * update protocol version check
This commit is contained in:
parent
3fe6571e7d
commit
ba79bf87aa
|
@ -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…
Reference in New Issue