Skip to content

Commit

Permalink
Minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
aopoltorzhicky committed Oct 14, 2023
1 parent 7730bdb commit 15d75d0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
19 changes: 7 additions & 12 deletions cmd/mempool/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package main

import (
"context"
"fmt"
"strings"

"github.com/dipdup-net/go-lib/node"
Expand Down Expand Up @@ -180,17 +179,13 @@ func (indexer *Indexer) appliedOperationProcess(ctx context.Context, tx bun.IDB,
}

if indexer.hasManager {
key := fmt.Sprintf("gas:%s", operation.Hash)
if !indexer.cache.Has(key) {
indexer.cache.Set(key)
gasStats := models.GasStats{
Network: indexer.network,
Hash: operation.Hash,
LevelInMempool: indexer.state.Level,
}
if err := gasStats.Save(ctx, tx); err != nil {
return err
}
gasStats := models.GasStats{
Network: indexer.network,
Hash: operation.Hash,
LevelInMempool: indexer.state.Level,
}
if err := gasStats.Save(ctx, tx); err != nil {
return err
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion cmd/mempool/indexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,8 @@ func (indexer *Indexer) onRollbackBlockQueue(ctx context.Context, block Block) e
if err := models.Rollback(ctx, tx, indexer.network, block.Branch, block.Level, indexer.filters.Kinds...); err != nil {
return err
}
return indexer.db.UpdateState(ctx, indexer.state)
_, err := tx.NewUpdate().Model(indexer.state).WherePK().Exec(ctx)
return err
})

}
Expand Down

0 comments on commit 15d75d0

Please sign in to comment.