From 7bd634cbf869cdd4598034338fcd43a68a6546e9 Mon Sep 17 00:00:00 2001 From: HCLivess Date: Sun, 16 Sep 2018 11:48:08 -0500 Subject: [PATCH] convert dicts to actual json comment out prints in options per request --- commands.py | 42 ++++++++++++++---------------------------- options.py | 4 ++-- peers.txt | 30 ++++++++++++++++++++++++++++-- suggested_peers.txt | 8 +++++++- wallet.py | 1 + 5 files changed, 52 insertions(+), 33 deletions(-) diff --git a/commands.py b/commands.py index 24a3f52d..87fe8e29 100644 --- a/commands.py +++ b/commands.py @@ -1,4 +1,4 @@ -import socks, connections, time, sys +import socks, connections, time, sys, json import options config = options.Get() config.read() @@ -92,8 +92,9 @@ def diffgetjson(socket): #check difficulty connections.send(s, "diffgetjson", 10) response = connections.receive(s, 10) - for key in response: - print (key,":",response[key]) + #for key in response: + # print (key,":",response[key]) + print(json.dumps(response)) #check difficulty def balanceget(socket, arg1): @@ -114,8 +115,7 @@ def balancegetjson(socket, arg1): connections.send(s, "balancegetjson", 10) connections.send(s, arg1, 10) response = connections.receive(s, 10) - for key in response: - print (key,":",response[key]) + print(json.dumps(response)) #get balance #insert to mempool @@ -139,9 +139,7 @@ def mpgetjson(socket): connections.send(s, "mpgetjson", 10) response_list = connections.receive(s, 10) print ("Current mempool:") - for response in response_list: - for key in response: - print (key,":",response[key]) + print(json.dumps(response_list)) #ask for mempool def difflast(socket): @@ -158,8 +156,7 @@ def difflastjson(socket): #ask for last difficulty connections.send(s, "difflastjson", 10) response = connections.receive(s, 10) - for key in response: - print (key,":",response[key]) + print(json.dumps(response)) #ask for last difficulty def blocklast(socket): @@ -176,8 +173,7 @@ def blocklastjson(socket): #get last block connections.send(s, "blocklastjson", 10) response = connections.receive(s, 10) - for key in response: - print (key,":",response[key]) + print(json.dumps(response)) #get last block @@ -197,8 +193,7 @@ def keygenjson(socket): #RECEIVES PRIVATE KEY FROM NODE connections.send(s, "keygenjson", 10) response = connections.receive(s, 10) - for key in response: - print (key,":",response[key]) + print(json.dumps(response)) #generate address def blockget(socket, arg1): @@ -216,9 +211,7 @@ def blockgetjson(socket, arg1): connections.send(s, "blockgetjson", 10) connections.send(s, arg1, 10) response_list = connections.receive(s, 10) - for response in response_list: - for key in response: - print (key,":",response[key]) + print(json.dumps(response_list)) #get block def addlist(socket, arg1): @@ -249,9 +242,7 @@ def addlistlimjson(socket, arg1, arg2): connections.send(s, arg2, 10) response_list = connections.receive(s, 10) print("Transactions for requested address:") - for response in response_list: - for key in response: - print (key,":",response[key]) + print(json.dumps(response_list)) #get all txs for an address def addlistlimmir(socket, arg1, arg2): @@ -272,9 +263,7 @@ def addlistlimmirjson(socket, arg1, arg2): connections.send(s, arg2, 10) response_list = connections.receive(s, 10) print("Mirror transactions for requested address:") - for response in response_list: - for key in response: - print (key,":",response[key]) + print(json.dumps(response_list)) #get all txs for an address def listlim(socket, arg1): @@ -292,9 +281,7 @@ def listlimjson(socket, arg1): connections.send(s, arg1, 10) response_list = connections.receive(s, 10) print("All transactions for requested range:") - for response in response_list: - for key in response: - print (key,":",response[key]) + print(json.dumps(response_list)) def txsend(socket, arg1, arg2, arg3, arg4, arg5): #generate transaction @@ -341,8 +328,7 @@ def peersget(socket): def statusget(socket): connections.send(s, "statusjson", 10) response = connections.receive(s, 10) - for key in response: - print (key,":",response[key]) + print(json.dumps(response)) def addvalidate(socket, arg1): connections.send(s, "addvalidate", 10) diff --git a/options.py b/options.py index 76a9a4f0..6c5580c0 100644 --- a/options.py +++ b/options.py @@ -45,7 +45,7 @@ class Get: } def load_file(self,filename): - print("Loading",filename) + #print("Loading",filename) for line in open(filename): if '=' in line: left,right = map(str.strip,line.rstrip("\n").split("=")) @@ -72,7 +72,7 @@ def load_file(self,filename): setattr(self,left,right) # Default genesis to keep compatibility self.genesis_conf = "4edadac9093d9326ee4b17f869b14f1a2534f96f9c5d7b48dc9acaed" - print(self.__dict__) + #print(self.__dict__) def read(self): # first of all, load from default config so we have all needed params diff --git a/peers.txt b/peers.txt index 37df795e..8b4e4e78 100644 --- a/peers.txt +++ b/peers.txt @@ -40,7 +40,6 @@ ('54.39.144.62', '5658') ('163.172.161.7', '5658') ('51.15.228.170', '5658') -('149.28.122.54', '5658') ('209.250.237.31', '5658') ('149.28.120.120', '5658') ('108.61.117.70', '5658') @@ -62,6 +61,33 @@ ('24.172.73.118', '5658') ('159.69.147.99', '5658') ('149.28.245.191', '5658') -('127.0.0.1', '5658') ('209.182.233.16', '5658') ('188.166.118.218', '5658') +('199.247.0.43', '5658') +('51.15.211.156', '5658') +('204.12.231.58', '5658') +('204.12.231.62', '5658') +('159.69.147.100', '5658') +('45.77.6.146', '5658') +('88.198.65.235', '5658') +('50.3.86.104', '5658') +('178.128.150.29', '5658') +('217.23.14.6', '5658') +('51.68.190.246', '5658') +('144.202.6.124', '5658') +('104.238.173.26', '5658') +('159.69.44.135', '5658') +('45.33.8.142', '5658') +('104.225.219.242', '5658') +('217.23.4.201', '5658') +('95.179.163.183', '5658') +('52.47.144.143', '5658') +('139.180.199.99', '5658') +('45.63.43.83', '5658') +('83.84.166.127', '5658') +('51.15.37.127', '5658') +('145.239.149.71', '5658') +('35.237.184.166', '5658') +('80.211.190.140', '5658') +('159.89.10.229', '5658') +('127.0.0.1', '5658') diff --git a/suggested_peers.txt b/suggested_peers.txt index baef71be..1c1f2d3e 100644 --- a/suggested_peers.txt +++ b/suggested_peers.txt @@ -7,7 +7,6 @@ ('167.114.129.139', '5658') ('209.182.233.16', '5658') ('45.77.6.146', '5658') -('127.0.0.1', '5658') ('144.202.6.124', '5658') ('104.238.173.26', '5658') ('108.61.166.237', '5658') @@ -44,3 +43,10 @@ ('217.23.4.201', '5658') ('51.68.190.246', '5658') ('51.15.211.156', '5658') +('139.180.199.99', '5658') +('91.92.136.112', '5658') +('82.16.135.238', '5658') +('104.238.189.234', '5658') +('109.190.174.238', '5658') +('109.236.82.102', '5658') +('127.0.0.1', '5658') diff --git a/wallet.py b/wallet.py index 3f24f565..54975225 100644 --- a/wallet.py +++ b/wallet.py @@ -99,6 +99,7 @@ # benchmark light_ip-list light_ip = lwbench.time_measure(light_ip, app_log) #light_ip.insert(0,node_ip) +#light_ip = "127.0.0.1:8150" def mempool_clear(s): connections.send(s, "mpclear", 10)