From 77d4bf6a28da1b73c74a0475c0831512d8d640d3 Mon Sep 17 00:00:00 2001 From: Danno Ferrin Date: Mon, 7 Jan 2019 08:52:38 -0700 Subject: [PATCH] Metrics measurement adjustment (#511) The total difficulty of mainnet is larger than a signed long, so we need to adjust the way we get the number. --- .../pantheon/ethereum/db/DefaultMutableBlockchain.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ethereum/core/src/main/java/tech/pegasys/pantheon/ethereum/db/DefaultMutableBlockchain.java b/ethereum/core/src/main/java/tech/pegasys/pantheon/ethereum/db/DefaultMutableBlockchain.java index 308e95b19f..d5b9bcd7c6 100644 --- a/ethereum/core/src/main/java/tech/pegasys/pantheon/ethereum/db/DefaultMutableBlockchain.java +++ b/ethereum/core/src/main/java/tech/pegasys/pantheon/ethereum/db/DefaultMutableBlockchain.java @@ -32,6 +32,7 @@ import tech.pegasys.pantheon.metrics.MetricCategory; import tech.pegasys.pantheon.metrics.MetricsSystem; import tech.pegasys.pantheon.util.Subscribers; +import tech.pegasys.pantheon.util.bytes.BytesValues; import tech.pegasys.pantheon.util.uint.UInt256; import java.util.ArrayList; @@ -69,7 +70,9 @@ public DefaultMutableBlockchain( MetricCategory.BLOCKCHAIN, "difficulty_total", "Total difficulty of the chainhead", - () -> (double) this.getChainHead().getTotalDifficulty().toLong()); + () -> + BytesValues.asUnsignedBigInteger(this.getChainHead().getTotalDifficulty().getBytes()) + .doubleValue()); } @Override