aboutsummaryrefslogtreecommitdiffstats
path: root/core/consensus.go
diff options
context:
space:
mode:
authorMission Liao <mission.liao@dexon.org>2018-08-30 15:09:15 +0800
committerGitHub <noreply@github.com>2018-08-30 15:09:15 +0800
commit8cb1d5c4f3f7f93d8b2c54addf5c2caced0a1eb8 (patch)
treeb9ea30e61b410557cc87aa4d828c4cb3cf771984 /core/consensus.go
parent1f34da04eb9d80648349140eb1442cab87ba5cd8 (diff)
downloadtangerine-consensus-8cb1d5c4f3f7f93d8b2c54addf5c2caced0a1eb8.tar
tangerine-consensus-8cb1d5c4f3f7f93d8b2c54addf5c2caced0a1eb8.tar.gz
tangerine-consensus-8cb1d5c4f3f7f93d8b2c54addf5c2caced0a1eb8.tar.bz2
tangerine-consensus-8cb1d5c4f3f7f93d8b2c54addf5c2caced0a1eb8.tar.lz
tangerine-consensus-8cb1d5c4f3f7f93d8b2c54addf5c2caced0a1eb8.tar.xz
tangerine-consensus-8cb1d5c4f3f7f93d8b2c54addf5c2caced0a1eb8.tar.zst
tangerine-consensus-8cb1d5c4f3f7f93d8b2c54addf5c2caced0a1eb8.zip
core: tune total ordering performance (#81)
- Replace map with slice Compared to slice, accessing to map is slower and the memory usage is inefficient.
Diffstat (limited to 'core/consensus.go')
-rw-r--r--core/consensus.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/core/consensus.go b/core/consensus.go
index 36cd57e..6c841bf 100644
--- a/core/consensus.go
+++ b/core/consensus.go
@@ -84,10 +84,14 @@ func NewConsensus(
}
// Setup sequencer by information returned from Governace.
+ var validators types.ValidatorIDs
+ for vID := range validatorSet {
+ validators = append(validators, vID)
+ }
to := newTotalOrdering(
uint64(gov.GetTotalOrderingK()),
uint64(float32(len(validatorSet)-1)*gov.GetPhiRatio()+1),
- uint64(len(validatorSet)))
+ validators)
return &Consensus{
rbModule: rb,