You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
605 B

#!/usr/bin/env python
from electrum import SimpleConfig, set_verbosity
from electrum.network import filter_protocol
import time, Queue
from collections import defaultdict
10 years ago
import util, json
set_verbosity(False)
config = SimpleConfig()
servers = filter_protocol(protocol = 't')
results = util.send_request(servers, 'blockchain.headers.subscribe', [])
10 years ago
d = defaultdict(int)
10 years ago
for k, r in results.items():
blocks = r.get('block_height')
d[blocks] += 1
12 years ago
10 years ago
for k, v in results.items():
print k, v.get('block_height')
v = d.values()
numblocks = d.keys()[v.index(max(v))]
10 years ago
print "blocks:",numblocks