mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-20 21:54:30 +00:00
trim m2 set to fit m1 set
This commit is contained in:
parent
b8cb19732f
commit
823cd1e6ef
1 changed files with 5 additions and 3 deletions
|
|
@ -564,10 +564,12 @@ func GetM1M2FromCheckpointBlock(checkpointBlock *types.Block) (map[common.Addres
|
|||
validators := ExtractValidatorsFromBytes(checkpointBlock.Header().Validators)
|
||||
|
||||
if len(validators) < len(masternodes) {
|
||||
return nil, errors.New("Len(m2) is less than len(m1)")
|
||||
return nil, errors.New("len(m2) is less than len(m1)")
|
||||
}
|
||||
for i, m1 := range masternodes {
|
||||
m1m2[m1] = masternodes[validators[i]]
|
||||
if len(masternodes) > 0 {
|
||||
for i, m1 := range masternodes {
|
||||
m1m2[m1] = masternodes[validators[i]%int64(len(masternodes))]
|
||||
}
|
||||
}
|
||||
return m1m2, nil
|
||||
}
|
||||
Loading…
Reference in a new issue