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
|
@ -158,24 +158,19 @@ func (n *Notary) OnPersist(ic *interop.Context) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// OnPersistEnd updates cached Policy values if they've been changed
|
||||
func (n *Notary) OnPersistEnd(dao dao.DAO) error {
|
||||
// PostPersist implements Contract interface.
|
||||
func (n *Notary) PostPersist(ic *interop.Context) error {
|
||||
n.lock.Lock()
|
||||
defer n.lock.Unlock()
|
||||
if n.isValid {
|
||||
return nil
|
||||
}
|
||||
n.lock.Lock()
|
||||
defer n.lock.Unlock()
|
||||
|
||||
n.maxNotValidBeforeDelta = getUint32WithKey(n.ContractID, dao, maxNotValidBeforeDeltaKey, defaultMaxNotValidBeforeDelta)
|
||||
n.maxNotValidBeforeDelta = getUint32WithKey(n.ContractID, ic.DAO, maxNotValidBeforeDeltaKey, defaultMaxNotValidBeforeDelta)
|
||||
n.isValid = true
|
||||
return nil
|
||||
}
|
||||
|
||||
// PostPersist implements Contract interface.
|
||||
func (n *Notary) PostPersist(ic *interop.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// onPayment records deposited amount as belonging to "from" address with a lock
|
||||
// till the specified chain's height.
|
||||
func (n *Notary) onPayment(ic *interop.Context, args []stackitem.Item) stackitem.Item {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue