mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-22 09:29:38 +00:00
native: optimize policy check for transaction's signers
Do not retrieve RO cache for each signer, make it ones per transaction instead. Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
This commit is contained in:
parent
de38163f89
commit
ba4c58780c
1 changed files with 2 additions and 1 deletions
|
@ -365,8 +365,9 @@ func (p *Policy) unblockAccount(ic *interop.Context, args []stackitem.Item) stac
|
|||
// like not being signed by a blocked account or not exceeding the block-level system
|
||||
// fee limit.
|
||||
func (p *Policy) CheckPolicy(d *dao.Simple, tx *transaction.Transaction) error {
|
||||
cache := d.GetROCache(p.ID).(*PolicyCache)
|
||||
for _, signer := range tx.Signers {
|
||||
if _, isBlocked := p.isBlockedInternal(d.GetROCache(p.ID).(*PolicyCache), signer.Account); isBlocked {
|
||||
if _, isBlocked := p.isBlockedInternal(cache, signer.Account); isBlocked {
|
||||
return fmt.Errorf("account %s is blocked", signer.Account.StringLE())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue