Merge branch 'master' of github.com:harmony-one/harmony into staking_pangaea

pull/1996/head
Rongjian Lan 5 years ago
commit 937b99828c
  1. 16
      shard/committee/assignment.go

@ -163,28 +163,26 @@ func eposStakedCommittee(
} }
shardCount := int(s.NumShards()) shardCount := int(s.NumShards())
shardState := &shard.State{} shardState := &shard.State{}
shardState.Shards = make([]shard.Committee, shardCount) shardState.Shards = make([]shard.Committee, shardCount)
hAccounts := s.HmyAccounts() hAccounts := s.HmyAccounts()
shardHarmonyNodes := s.NumHarmonyOperatedNodesPerShard()
// Shard state needs to be sorted by shard ID
for i := 0; i < shardCount; i++ { for i := 0; i < shardCount; i++ {
shardState.Shards[i] = shard.Committee{uint32(i), shard.SlotList{}} shardState.Shards[i] = shard.Committee{uint32(i), shard.SlotList{}}
} for j := 0; j < shardHarmonyNodes; j++ {
index := i + j*shardCount
for i := range hAccounts {
shardID := i % shardCount
pub := &bls.PublicKey{} pub := &bls.PublicKey{}
pub.DeserializeHexStr(hAccounts[i].BlsPublicKey) pub.DeserializeHexStr(hAccounts[index].BlsPublicKey)
pubKey := shard.BlsPublicKey{} pubKey := shard.BlsPublicKey{}
pubKey.FromLibBLSPublicKey(pub) pubKey.FromLibBLSPublicKey(pub)
shardState.Shards[shardID].Slots = append(shardState.Shards[shardID].Slots, shard.Slot{ shardState.Shards[i].Slots = append(shardState.Shards[i].Slots, shard.Slot{
common2.ParseAddr(hAccounts[i].Address), common2.ParseAddr(hAccounts[index].Address),
pubKey, pubKey,
nil, nil,
}) })
} }
}
if stakedSlotsCount == 0 { if stakedSlotsCount == 0 {
utils.Logger().Info().Int("slots-for-epos", stakedSlotsCount). utils.Logger().Info().Int("slots-for-epos", stakedSlotsCount).

Loading…
Cancel
Save