Skip to content
This repository has been archived by the owner on Jul 3, 2022. It is now read-only.

Commit

Permalink
convert dicts to actual json
Browse files Browse the repository at this point in the history
comment out prints in options per request
  • Loading branch information
hclivess committed Sep 16, 2018
1 parent 384ef42 commit 7bd634c
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 33 deletions.
42 changes: 14 additions & 28 deletions commands.py
@@ -1,4 +1,4 @@
import socks, connections, time, sys
import socks, connections, time, sys, json
import options
config = options.Get()
config.read()
Expand Down Expand Up @@ -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):
Expand All @@ -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
Expand All @@ -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):
Expand All @@ -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):
Expand All @@ -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


Expand All @@ -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):
Expand All @@ -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):
Expand Down Expand Up @@ -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):
Expand All @@ -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):
Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions options.py
Expand Up @@ -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("="))
Expand All @@ -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
Expand Down
30 changes: 28 additions & 2 deletions peers.txt
Expand Up @@ -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')
Expand All @@ -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')
8 changes: 7 additions & 1 deletion suggested_peers.txt
Expand Up @@ -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')
Expand Down Expand Up @@ -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')
1 change: 1 addition & 0 deletions wallet.py
Expand Up @@ -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)
Expand Down

0 comments on commit 7bd634c

Please sign in to comment.