dht: fix TestLayeredGet

The test was occasionally passing because:
- it called `putLocal(key, val)`
- GetValue calls `getLocal(key)` optimistically.

cc @whyrusleeping

Squashed:
some better logging and cleanup
address comments from PR
use query for getClosestPeers
Improve readability of getClosestPeers method.

Also remove older useless code.