From b48a7ca9e641a99341bc8b0b16d3c2a26786a045 Mon Sep 17 00:00:00 2001 From: Minh Doan Date: Thu, 28 Feb 2019 22:17:16 -0800 Subject: [PATCH] modify shard state --- core/types/shard_state.go | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/core/types/shard_state.go b/core/types/shard_state.go index 879d62629..f280bf299 100644 --- a/core/types/shard_state.go +++ b/core/types/shard_state.go @@ -7,8 +7,17 @@ import ( "golang.org/x/crypto/sha3" ) -// NodeID is a unique ID represent a node -type NodeID string +type NodeRole byte + +const ( + Leader NodeRole = iota + Validator +) + +type NodeInfo struct { + NodeID string + Role NodeRole +} // ShardState is the collection of all committees type ShardState []Committee @@ -16,7 +25,7 @@ type ShardState []Committee // Committee contains the active nodes in one shard type Committee struct { ShardID uint32 - NodeList []NodeID // a list of NodeID where NodeID is represented by a string + NodeList []NodeInfo } // GetHashFromNodeList will sort the list, then use Keccak256 to hash the list