mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-02 09:45:50 +00:00
core: add Persist() to dao()
Hide its internals a little, which is gonna be useful for future composition.
This commit is contained in:
parent
eb1749d190
commit
09223236f9
2 changed files with 9 additions and 3 deletions
|
@ -505,7 +505,7 @@ func (bc *Blockchain) storeBlock(block *Block) error {
|
||||||
v.LoadScript(t.Script)
|
v.LoadScript(t.Script)
|
||||||
err := v.Run()
|
err := v.Run()
|
||||||
if !v.HasFailed() {
|
if !v.HasFailed() {
|
||||||
_, err := systemInterop.dao.store.Persist()
|
_, err := systemInterop.dao.Persist()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, "failed to persist invocation results")
|
return errors.Wrap(err, "failed to persist invocation results")
|
||||||
}
|
}
|
||||||
|
@ -554,7 +554,7 @@ func (bc *Blockchain) storeBlock(block *Block) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_, err := cache.store.Persist()
|
_, err := cache.Persist()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -690,7 +690,7 @@ func (bc *Blockchain) persist() error {
|
||||||
err error
|
err error
|
||||||
)
|
)
|
||||||
|
|
||||||
persisted, err = bc.dao.store.Persist()
|
persisted, err = bc.dao.Persist()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -555,3 +555,9 @@ func (dao *dao) IsDoubleSpend(tx *transaction.Transaction) bool {
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Persist flushes all the changes made into the (supposedly) persistent
|
||||||
|
// underlying store.
|
||||||
|
func (dao *dao) Persist() (int, error) {
|
||||||
|
return dao.store.Persist()
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue