mirror of
https://github.com/alexgo-io/stacks-puppet-node.git
synced 2026-04-15 12:07:17 +08:00
* use metropolis-hastings random walk with random backtracking (variant of MRWB) to sample the peer graph in as unbiased a way as we can. The only major difference between this and MRWB is that we don't maintain a peer stack; we just select a random peer instead of backtracking. * keep the peer table and the peer database in sync--the table is the cache-coherent copy. * keep only 65536 peers. Hash the peer address and a nonce to select a slot, and ping an old peer before evicting it on collision (and keep the old peer on collision if it responds) * a peer can ask for all other peers. * remove up to 10 peers that are unhealthy per walk; add up to 10 new peers that we discover on remote peer queries. * use socket-determined peer address, not RPC-given peer address * various code cleanups.