mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 10:22:23 +00:00
trim m2 set to fit m1 set
This commit is contained in:
parent
80cefd3e55
commit
6d7cfe14d8
1 changed files with 5 additions and 3 deletions
|
|
@ -579,10 +579,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)")
|
||||
}
|
||||
if len(masternodes) > 0 {
|
||||
for i, m1 := range masternodes {
|
||||
m1m2[m1] = masternodes[validators[i]]
|
||||
m1m2[m1] = masternodes[validators[i]%int64(len(masternodes))]
|
||||
}
|
||||
}
|
||||
return m1m2, nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue