Query params can be used to adjust the number of peers required and number of blocks tolerance to be considered in sync.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
Previously was only set after callbacks were invoked, allowing additional messages to be sent while parts of the supporting infrastructure for the peer was being torn down.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
Adds metrics to expose:
* height of best known block
* synchronizer in sync flag
* max peers
* Timestamp of current chain head
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
* Don't copy collections if we don't need to. Change types higher up if needed.
* Don't use Guava's Object.equal, use Java's Objects.equals.
** add errorprone test to enforce the banning of Guava's Objects class.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
* Change all Stream<?> getX() and Stream<?> x() methods to Stream<?> streanX methods, such as `Stream<Peer> streamIdlePeers()`
* Update coding conventions to reflect this.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
Move RocksDBStats to it's own module. This also brings metrics to
metrics:core since none of our other module have nested modules but
they have peer modules.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
Only specify discovery port explicitly when the discovery port differs
from the listening port.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
Because of deep issues sometimes we get duplicate Peers that differ
in small ways. Tweak the test to verify we get all of the peers
we are expecting and to be tolerant of quasi-duplicate peers.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
* Number of metrics labels need to match up with constructor
* Number of labels must be consistant, so I split it into two metrics
* Also, naming best practices say that sum() and avg() of a metric
should be meaningful, separating into two metrics fixes that.
* fix style issues (finals, intellij warnings)
* Change NoOpMetrics to check label count.
* Cascading changes to support this in many support classes. Mostly places
we presumed all NoOpMetrics were equals.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
When receiving an AddPeer, or when loading the static-nodes.json file, pantheon
should not accept its own NodeID as a valid connection (however, this should not invalidate the static-nodes file).
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>