Browse Source

modified: examples/halving-calculator.py

The MMGen Project 4 years ago
parent
commit
9d8b90f705
1 changed files with 7 additions and 2 deletions
  1. 7 2
      examples/halving-calculator.py

+ 7 - 2
examples/halving-calculator.py

@@ -27,8 +27,13 @@ def time_diff_warning(t_diff):
 			('behind','ahead of')[t_diff<0]))
 
 async def main():
+
+	from mmgen.protocol import init_proto_from_opts
+	proto = init_proto_from_opts()
+
 	from mmgen.rpc import rpc_init
-	c = await rpc_init()
+	c = await rpc_init(proto)
+
 	tip = await c.call('getblockcount')
 	remaining = HalvingInterval - tip % HalvingInterval
 	sample_size = max(remaining,144)
@@ -52,4 +57,4 @@ async def main():
 	print(f'Est. halving date (UTC):  {date(cur["time"] + t_rem)}')
 	print(f'Est. time until halving:  {dhms(cur["time"] + t_rem - clock_time)}')
 
-run_session(main(),do_rpc_init=False)
+run_session(main())