mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2025-05-06 09:55:09 +00:00
native: drop OnPersistEnd
Now that PostPersist is being run for every native contract we can do our dirty caching tricks right there instead of OnPersistEnd.
This commit is contained in:
parent
938be298f0
commit
cb5ecaefe7
9 changed files with 21 additions and 64 deletions
|
@ -320,7 +320,14 @@ func (n *NEO) PostPersist(ic *interop.Context) error {
|
|||
}
|
||||
|
||||
}
|
||||
n.OnPersistEnd(ic.DAO)
|
||||
if n.gasPerBlockChanged.Load().(bool) {
|
||||
gr, err := n.getSortedGASRecordFromDAO(ic.DAO)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
n.gasPerBlock.Store(gr)
|
||||
n.gasPerBlockChanged.Store(false)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -347,18 +354,6 @@ func (n *NEO) getGASPerVote(d dao.DAO, key []byte, index ...uint32) []big.Int {
|
|||
return reward
|
||||
}
|
||||
|
||||
// OnPersistEnd updates cached values if they've been changed.
|
||||
func (n *NEO) OnPersistEnd(d dao.DAO) {
|
||||
if n.gasPerBlockChanged.Load().(bool) {
|
||||
gr, err := n.getSortedGASRecordFromDAO(d)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
n.gasPerBlock.Store(gr)
|
||||
n.gasPerBlockChanged.Store(false)
|
||||
}
|
||||
}
|
||||
|
||||
func (n *NEO) increaseBalance(ic *interop.Context, h util.Uint160, si *state.StorageItem, amount *big.Int) error {
|
||||
acc, err := state.NEOBalanceStateFromBytes(si.Value)
|
||||
if err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue