From 3ce371986b45be4f44429147874822482b73b673 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Sun, 7 Jan 2024 09:02:39 -0500 Subject: [PATCH] refactor: add NetworkId() to node --- interfaces/node.go | 1 + interfaces/p2p.go | 1 + node/node.go | 4 ++++ 3 files changed, 6 insertions(+) diff --git a/interfaces/node.go b/interfaces/node.go index 4476fea..26509bd 100644 --- a/interfaces/node.go +++ b/interfaces/node.go @@ -18,4 +18,5 @@ type Node interface { Start() error GetCachedStorageLocations(hash *encoding.Multihash, types []int) (map[string]StorageLocation, error) AddStorageLocation(hash *encoding.Multihash, nodeId *encoding.NodeId, location StorageLocation, message []byte, config *config.NodeConfig) error + NetworkId() string } diff --git a/interfaces/p2p.go b/interfaces/p2p.go index 58871e2..d44ef47 100644 --- a/interfaces/p2p.go +++ b/interfaces/p2p.go @@ -19,4 +19,5 @@ type P2PService interface { ReadNodeScore(nodeId *encoding.NodeId) (NodeVotes, error) GetNodeScore(nodeId *encoding.NodeId) (float64, error) SortNodesByScore(nodes []*encoding.NodeId) ([]*encoding.NodeId, error) + SignMessageSimple(message []byte) ([]byte, error) } diff --git a/node/node.go b/node/node.go index d3e06da..404e538 100644 --- a/node/node.go +++ b/node/node.go @@ -27,6 +27,10 @@ type NodeImpl struct { cacheBucket *bolt.Bucket } +func (n *NodeImpl) NetworkId() string { + return n.nodeConfig.P2P.Network +} + func (n *NodeImpl) Services() interfaces.Services { return n.services }