mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-18 19:00:46 +00:00
fetch data from StateDB instead of Contract.
This commit is contained in:
parent
ff56f5e50f
commit
70e0496138
1 changed files with 15 additions and 20 deletions
|
|
@ -2428,26 +2428,21 @@ func (bc *BlockChain) UpdateM1() error {
|
||||||
}
|
}
|
||||||
opts := new(bind.CallOpts)
|
opts := new(bind.CallOpts)
|
||||||
|
|
||||||
// var candidates []common.Address
|
var candidates []common.Address
|
||||||
// // get candidates from slot of stateDB
|
// get candidates from slot of stateDB
|
||||||
// // if can't get anything, request from contracts
|
// if can't get anything, request from contracts
|
||||||
// stateDB, err := bc.State()
|
stateDB, err := bc.State()
|
||||||
// if err != nil {
|
|
||||||
|
|
||||||
// candidates, err = validator.GetCandidates(opts)
|
|
||||||
// if err != nil {
|
|
||||||
|
|
||||||
// return err
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
|
|
||||||
// candidates = state.GetCandidates(stateDB)
|
|
||||||
|
|
||||||
// }
|
|
||||||
|
|
||||||
candidates, err := validator.GetCandidates(opts)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
|
||||||
|
candidates, err = validator.GetCandidates(opts)
|
||||||
|
if err != nil {
|
||||||
|
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
|
||||||
|
candidates = state.GetCandidates(stateDB)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var ms []utils.Masternode
|
var ms []utils.Masternode
|
||||||
|
|
@ -2487,7 +2482,7 @@ func (bc *BlockChain) UpdateM1() error {
|
||||||
maxMasternodes = common.MaxMasternodes
|
maxMasternodes = common.MaxMasternodes
|
||||||
}
|
}
|
||||||
if len(ms) > maxMasternodes {
|
if len(ms) > maxMasternodes {
|
||||||
err = engine.UpdateMasternodes(bc, bc.CurrentHeader(), ms[:common.MaxMasternodes])
|
err = engine.UpdateMasternodes(bc, bc.CurrentHeader(), ms[:maxMasternodes])
|
||||||
} else {
|
} else {
|
||||||
err = engine.UpdateMasternodes(bc, bc.CurrentHeader(), ms)
|
err = engine.UpdateMasternodes(bc, bc.CurrentHeader(), ms)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue