mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-21 23:29:38 +00:00
native: refactor argument of NEO's getCommitteeMembers function
No funcional changes, just refactoring. It doesn't need the whole cache, only the set of committee keys with votes. Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
This commit is contained in:
parent
794658b54c
commit
27dddb4d50
1 changed files with 4 additions and 5 deletions
|
@ -363,7 +363,7 @@ func (n *NEO) initConfigCache(cfg config.ProtocolConfiguration) error {
|
|||
func (n *NEO) updateCache(cache *NeoCache, cvs keysWithVotes, blockHeight uint32) error {
|
||||
cache.committee = cvs
|
||||
|
||||
var committee = getCommitteeMembers(cache)
|
||||
var committee = getCommitteeMembers(cache.committee)
|
||||
script, err := smartcontract.CreateMajorityMultiSigRedeemScript(committee.Copy())
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -431,7 +431,7 @@ func (n *NEO) OnPersist(ic *interop.Context) error {
|
|||
func (n *NEO) PostPersist(ic *interop.Context) error {
|
||||
gas := n.GetGASPerBlock(ic.DAO, ic.Block.Index)
|
||||
cache := ic.DAO.GetROCache(n.ID).(*NeoCache)
|
||||
pubs := getCommitteeMembers(cache)
|
||||
pubs := getCommitteeMembers(cache.committee)
|
||||
committeeSize := n.cfg.GetCommitteeSize(ic.Block.Index)
|
||||
index := int(ic.Block.Index) % committeeSize
|
||||
committeeReward := new(big.Int).Mul(gas, bigCommitteeRewardRatio)
|
||||
|
@ -1137,11 +1137,10 @@ func (n *NEO) modifyVoterTurnout(d *dao.Simple, amount *big.Int) error {
|
|||
// GetCommitteeMembers returns public keys of nodes in committee using cached value.
|
||||
func (n *NEO) GetCommitteeMembers(d *dao.Simple) keys.PublicKeys {
|
||||
cache := d.GetROCache(n.ID).(*NeoCache)
|
||||
return getCommitteeMembers(cache)
|
||||
return getCommitteeMembers(cache.committee)
|
||||
}
|
||||
|
||||
func getCommitteeMembers(cache *NeoCache) keys.PublicKeys {
|
||||
var cvs = cache.committee
|
||||
func getCommitteeMembers(cvs keysWithVotes) keys.PublicKeys {
|
||||
var committee = make(keys.PublicKeys, len(cvs))
|
||||
var err error
|
||||
for i := range committee {
|
||||
|
|
Loading…
Reference in a new issue