diff options
author | Mission Liao <mission.liao@dexon.org> | 2018-09-20 09:09:37 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-20 09:09:37 +0800 |
commit | 421d72b2d796195178104a0eb1dedf319ba8664c (patch) | |
tree | f32f15c167989905494eca1891c3240b80dac1d6 /simulation/verification.go | |
parent | 37f117d35c6617e1944d45e001e03813a6a278ed (diff) | |
download | dexon-consensus-421d72b2d796195178104a0eb1dedf319ba8664c.tar dexon-consensus-421d72b2d796195178104a0eb1dedf319ba8664c.tar.gz dexon-consensus-421d72b2d796195178104a0eb1dedf319ba8664c.tar.bz2 dexon-consensus-421d72b2d796195178104a0eb1dedf319ba8664c.tar.lz dexon-consensus-421d72b2d796195178104a0eb1dedf319ba8664c.tar.xz dexon-consensus-421d72b2d796195178104a0eb1dedf319ba8664c.tar.zst dexon-consensus-421d72b2d796195178104a0eb1dedf319ba8664c.zip |
Rename validator* to node* (#120)
Diffstat (limited to 'simulation/verification.go')
-rw-r--r-- | simulation/verification.go | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/simulation/verification.go b/simulation/verification.go index 0ae7450..fd41cd9 100644 --- a/simulation/verification.go +++ b/simulation/verification.go @@ -44,20 +44,20 @@ type totalOrderStatus struct { // TotalOrderResult is the object maintaining peer's result of // Total Ordering Algorithm. type TotalOrderResult struct { - validatorID types.ValidatorID + nodeID types.NodeID hashList common.Hashes curID int pendingBlockList PendingBlockList status totalOrderStatus } -// PeerTotalOrder stores the TotalOrderResult of each validator. -type PeerTotalOrder = map[types.ValidatorID]*TotalOrderResult +// PeerTotalOrder stores the TotalOrderResult of each node. +type PeerTotalOrder = map[types.NodeID]*TotalOrderResult // NewTotalOrderResult returns pointer to a a new TotalOrderResult instance. -func NewTotalOrderResult(vID types.ValidatorID) *TotalOrderResult { +func NewTotalOrderResult(nID types.NodeID) *TotalOrderResult { totalOrder := &TotalOrderResult{ - validatorID: vID, + nodeID: nID, status: totalOrderStatus{ blockSeen: make(map[common.Hash]time.Time), }, @@ -172,15 +172,15 @@ func (totalOrder *TotalOrderResult) CalculateAverageTimestampLatency() ( } // VerifyTotalOrder verifies if the result of Total Ordering Algorithm -// returned by all validators are the same. However, the length of result -// of each validators may not be the same, so only the common part is verified. -func VerifyTotalOrder(id types.ValidatorID, +// returned by all nodes are the same. However, the length of result +// of each nodes may not be the same, so only the common part is verified. +func VerifyTotalOrder(id types.NodeID, totalOrder PeerTotalOrder) ( unverifiedMap PeerTotalOrder, correct bool, length int) { hasError := false - // Get the common length from all validators. + // Get the common length from all nodes. length = math.MaxInt32 for _, peerTotalOrder := range totalOrder { if len(peerTotalOrder.hashList) < length { @@ -218,8 +218,8 @@ func VerifyTotalOrder(id types.ValidatorID, // LogStatus prints all the status to log. func LogStatus(peerTotalOrder PeerTotalOrder) { - for vID, totalOrder := range peerTotalOrder { - log.Printf("[Validator %s]\n", vID) + for nID, totalOrder := range peerTotalOrder { + log.Printf("[Node %s]\n", nID) log.Printf(" BPS: %.6f\n", totalOrder.CalculateBlocksPerSecond()) log.Printf(" Confirm Latency: %.2fms\n", |