mirror of
https://github.com/arnaucube/hermez-node.git
synced 2026-02-06 19:06:42 +01:00
Delete old checkpoints in stateDB automatically
Introduce a constructor parameter for the StateDB called `keep`, which tells how many checkpoints to keep. When doing a new checkpoint, if the number of existing checkpoints exeeds `keep`, the oldest ones will be deleted.
This commit is contained in:
@@ -29,7 +29,8 @@ type ConfigBatch struct {
|
||||
// NewBatchBuilder constructs a new BatchBuilder, and executes the bb.Reset
|
||||
// method
|
||||
func NewBatchBuilder(dbpath string, synchronizerStateDB *statedb.StateDB, configCircuits []ConfigCircuit, batchNum common.BatchNum, nLevels uint64) (*BatchBuilder, error) {
|
||||
localStateDB, err := statedb.NewLocalStateDB(dbpath, synchronizerStateDB, statedb.TypeBatchBuilder, int(nLevels))
|
||||
localStateDB, err := statedb.NewLocalStateDB(dbpath, 128, synchronizerStateDB,
|
||||
statedb.TypeBatchBuilder, int(nLevels))
|
||||
if err != nil {
|
||||
return nil, tracerr.Wrap(err)
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ func TestBatchBuilder(t *testing.T) {
|
||||
defer assert.Nil(t, os.RemoveAll(dir))
|
||||
|
||||
chainID := uint16(0)
|
||||
synchDB, err := statedb.NewStateDB(dir, statedb.TypeBatchBuilder, 0, chainID)
|
||||
synchDB, err := statedb.NewStateDB(dir, 128, statedb.TypeBatchBuilder, 0, chainID)
|
||||
assert.Nil(t, err)
|
||||
|
||||
bbDir, err := ioutil.TempDir("", "tmpBatchBuilderDB")
|
||||
|
||||
Reference in New Issue
Block a user