mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-26 19:43:48 +00:00
core: remove unused context parameter from persist()
This commit is contained in:
parent
c885a69edb
commit
70407f0c19
2 changed files with 8 additions and 9 deletions
|
@ -175,7 +175,7 @@ func (bc *Blockchain) Run(ctx context.Context) {
|
|||
persistTimer := time.NewTimer(persistInterval)
|
||||
defer func() {
|
||||
persistTimer.Stop()
|
||||
if err := bc.persist(ctx); err != nil {
|
||||
if err := bc.persist(); err != nil {
|
||||
log.Warnf("failed to persist: %s", err)
|
||||
}
|
||||
if err := bc.store.Close(); err != nil {
|
||||
|
@ -191,7 +191,7 @@ func (bc *Blockchain) Run(ctx context.Context) {
|
|||
bc.headersOpDone <- struct{}{}
|
||||
case <-persistTimer.C:
|
||||
go func() {
|
||||
err := bc.persist(ctx)
|
||||
err := bc.persist()
|
||||
if err != nil {
|
||||
log.Warnf("failed to persist blockchain: %s", err)
|
||||
}
|
||||
|
@ -470,7 +470,7 @@ func (bc *Blockchain) storeBlock(block *Block) error {
|
|||
}
|
||||
|
||||
// persist flushes current in-memory store contents to the persistent storage.
|
||||
func (bc *Blockchain) persist(ctx context.Context) error {
|
||||
func (bc *Blockchain) persist() error {
|
||||
var (
|
||||
start = time.Now()
|
||||
persisted int
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package core
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/CityOfZion/neo-go/pkg/core/storage"
|
||||
|
@ -53,7 +52,7 @@ func TestAddBlock(t *testing.T) {
|
|||
assert.Equal(t, lastBlock.Hash(), bc.CurrentHeaderHash())
|
||||
|
||||
// This one tests persisting blocks, so it does need to persist()
|
||||
require.NoError(t, bc.persist(context.Background()))
|
||||
require.NoError(t, bc.persist())
|
||||
|
||||
for _, block := range blocks {
|
||||
key := storage.AppendPrefix(storage.DataBlock, block.Hash().BytesReverse())
|
||||
|
@ -82,7 +81,7 @@ func TestGetHeader(t *testing.T) {
|
|||
b2 := newBlock(2)
|
||||
_, err = bc.GetHeader(b2.Hash())
|
||||
assert.Error(t, err)
|
||||
assert.NoError(t, bc.persist(context.Background()))
|
||||
assert.NoError(t, bc.persist())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -106,7 +105,7 @@ func TestGetBlock(t *testing.T) {
|
|||
assert.Equal(t, blocks[i].Index, block.Index)
|
||||
assert.Equal(t, blocks[i].Hash(), block.Hash())
|
||||
}
|
||||
assert.NoError(t, bc.persist(context.Background()))
|
||||
assert.NoError(t, bc.persist())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -127,7 +126,7 @@ func TestHasBlock(t *testing.T) {
|
|||
}
|
||||
newBlock := newBlock(51)
|
||||
assert.False(t, bc.HasBlock(newBlock.Hash()))
|
||||
assert.NoError(t, bc.persist(context.Background()))
|
||||
assert.NoError(t, bc.persist())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -151,6 +150,6 @@ func TestGetTransaction(t *testing.T) {
|
|||
assert.Equal(t, 1, io.GetVarSize(tx.Inputs))
|
||||
assert.Equal(t, 1, io.GetVarSize(tx.Outputs))
|
||||
assert.Equal(t, 1, io.GetVarSize(tx.Scripts))
|
||||
assert.NoError(t, bc.persist(context.Background()))
|
||||
assert.NoError(t, bc.persist())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue