Skip to content
Snippets Groups Projects
Unverified Commit 2a57d54e authored by Angelo Capossele's avatar Angelo Capossele Committed by GitHub
Browse files

:lipstick: Make shown nodeIDs consistent (#515)

parent f4b7f3f8
No related branches found
No related tags found
No related merge requests found
......@@ -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,
......
......@@ -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{
......
......@@ -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()
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment