factor out some common code that checks for staleness of data from the code that handles cached blocks and keyhash blocks
factor out some common code that checks for staleness of data from the code that handles cached blocks and keyhash blocks

weidezhang/dht,sit/dht,weidezhang/dht,weidezhang/dht,sit/dht,sit/dht,weidezhang/dht,weidezhang/dht,sit/dht,sit/dht