modified: examples/halving-calculator.py

This commit is contained in:
The MMGen Project 2020-06-01 20:59:34 +00:00
commit 9d8b90f705
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2

View file

@ -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())