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:
Eduard S
2020-12-23 18:06:36 +01:00
parent 35d598f564
commit 2205fcadbc
17 changed files with 192 additions and 64 deletions

View File

@@ -72,7 +72,7 @@ type TxSelector struct {
// NewTxSelector returns a *TxSelector
func NewTxSelector(coordAccount *CoordAccount, dbpath string,
synchronizerStateDB *statedb.StateDB, l2 *l2db.L2DB) (*TxSelector, error) {
localAccountsDB, err := statedb.NewLocalStateDB(dbpath,
localAccountsDB, err := statedb.NewLocalStateDB(dbpath, 128,
synchronizerStateDB, statedb.TypeTxSelector, 0) // without merkletree
if err != nil {
return nil, tracerr.Wrap(err)