Last active
August 29, 2015 14:28
-
-
Save heikoheiko/7a690f46bb9c0a3b8d33 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# after entering the console of pyethapp | |
# https://github.com/ethereum/pyethapp/wiki/The_Console | |
from devp2p import kademlia | |
import gevent | |
def crawl(): | |
delay = 0.1 | |
lookups = 0 | |
kademlia_proto = eth.app.services.discovery.protocol.kademlia | |
while True: | |
if lookups % 10 == 0: | |
print('crawler', len(kademlia_proto.routing), lookups) | |
nodeid = kademlia.random_nodeid() | |
kademlia_proto.find_node(nodeid) | |
gevent.sleep(delay) | |
lookups += 1 | |
gevent.spawn(crawl) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment