diff --git a/plugins/analysis/dashboard/fpc_livefeed.go b/plugins/analysis/dashboard/fpc_livefeed.go index 5d981ac42fff9c064b506fd2749408c9eb1a10d1..1056cae688f8743e340ecb586e113109a158a8f4 100644 --- a/plugins/analysis/dashboard/fpc_livefeed.go +++ b/plugins/analysis/dashboard/fpc_livefeed.go @@ -14,7 +14,6 @@ import ( "github.com/iotaledger/hive.go/daemon" "github.com/iotaledger/hive.go/events" "github.com/iotaledger/hive.go/workerpool" - "github.com/mr-tron/base58/base58" ) const ( @@ -98,7 +97,7 @@ func runFPCLiveFeed() { func createFPCUpdate(hb *packet.FPCHeartbeat) *FPCUpdate { // prepare the update conflicts := make(conflictSet) - nodeID := base58.Encode(hb.OwnID) + nodeID := shortNodeIDString(hb.OwnID) for ID, context := range hb.RoundStats.ActiveVoteContexts { newVoteContext := voteContext{ NodeID: nodeID, diff --git a/plugins/analysis/dashboard/fpc_livefeed_test.go b/plugins/analysis/dashboard/fpc_livefeed_test.go index 9c2a4f8f6c096af995a29fdb6a34d5afe1324459..a5c4a8ea7c00fc8cad3153e0d2675c75bccb1657 100644 --- a/plugins/analysis/dashboard/fpc_livefeed_test.go +++ b/plugins/analysis/dashboard/fpc_livefeed_test.go @@ -7,14 +7,13 @@ import ( "github.com/iotaledger/goshimmer/packages/vote" "github.com/iotaledger/goshimmer/plugins/analysis/packet" - "github.com/mr-tron/base58/base58" "github.com/stretchr/testify/require" ) // TestCreateFPCUpdate checks that given a FPC heartbeat, the returned FPCUpdate is ok. func TestCreateFPCUpdate(t *testing.T) { ownID := sha256.Sum256([]byte{'A'}) - base58OwnID := base58.Encode(ownID[:]) + base58OwnID := shortNodeIDString(ownID[:]) // create a FPCHeartbeat hbTest := &packet.FPCHeartbeat{ diff --git a/plugins/metrics/global_metrics.go b/plugins/metrics/global_metrics.go index c6906653a9a6bbb542dd306546f581ad3dc86f12..4eee1bf14f6af22b3053b5253c6ad4ce31cd018e 100644 --- a/plugins/metrics/global_metrics.go +++ b/plugins/metrics/global_metrics.go @@ -6,7 +6,7 @@ import ( analysisdashboard "github.com/iotaledger/goshimmer/plugins/analysis/dashboard" "github.com/iotaledger/goshimmer/plugins/analysis/packet" "github.com/iotaledger/hive.go/events" - "github.com/mr-tron/base58/base58" + "github.com/iotaledger/hive.go/identity" "go.uber.org/atomic" ) @@ -32,7 +32,7 @@ var ( var onMetricHeartbeatReceived = events.NewClosure(func(hb *packet.MetricHeartbeat) { nodessMetricsMutex.Lock() defer nodessMetricsMutex.Unlock() - nodesMetrics[base58.Encode(hb.OwnID)] = NodeInfo{ + nodesMetrics[shortNodeIDString(hb.OwnID)] = NodeInfo{ OS: hb.OS, Arch: hb.Arch, NumCPU: hb.NumCPU, @@ -64,3 +64,9 @@ func calculateNetworkDiameter() { func NetworkDiameter() int32 { return networkDiameter.Load() } + +func shortNodeIDString(b []byte) string { + var id identity.ID + copy(id[:], b) + return id.String() +}