|
|
@@ -14,8 +14,10 @@ def send_transaction(sess, url, transaction):
|
|
|
resp = sess.put(url + 'new-transaction', data=transaction.to_json_compatible())
|
|
|
resp.raise_for_status()
|
|
|
|
|
|
-def network_state(sess, url):
|
|
|
- pass
|
|
|
+def network_info(sess, url):
|
|
|
+ resp = sess.get(url + 'network-info')
|
|
|
+ resp.raise_for_status()
|
|
|
+ return resp.json()
|
|
|
|
|
|
def get_transactions(sess, url, pubkey):
|
|
|
resp = sess.post(url + 'transactions', data=pubkey.as_bytes())
|
|
|
@@ -28,6 +30,8 @@ def main():
|
|
|
help="The RPC port of the miner to connect to.")
|
|
|
parser.add_argument("--show-transactions", type=argparse.FileType("rb"), default=[], action="append",
|
|
|
help="Shows all transactions involving the public key stored in the specified file.")
|
|
|
+ parser.add_argument("--show-network", action="store_true", default=False,
|
|
|
+ help="Prints networking information about the miner.")
|
|
|
args = parser.parse_args()
|
|
|
|
|
|
url = "http://localhost:{}/".format(args.miner_port)
|
|
|
@@ -38,5 +42,9 @@ def main():
|
|
|
print(trans.to_json_compatible())
|
|
|
key.close()
|
|
|
|
|
|
+ if args.show_network:
|
|
|
+ for [k, v] in network_info(s, url):
|
|
|
+ print("{}\t{}".format(k, v))
|
|
|
+
|
|
|
if __name__ == '__main__':
|
|
|
main()
|