From 9d8b90f7058bb13d4404d6224799b236b5246a5e Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Mon, 1 Jun 2020 20:59:34 +0000 Subject: [PATCH] modified: examples/halving-calculator.py --- examples/halving-calculator.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/examples/halving-calculator.py b/examples/halving-calculator.py index 325c7f60..149c18b8 100755 --- a/examples/halving-calculator.py +++ b/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())