PR Updates as per Ian's request

This commit is contained in:
Abdul Rabbani 2022-03-31 11:37:01 -04:00
parent a60d5a016d
commit 2e836e869a
2 changed files with 6 additions and 8 deletions

View File

@ -11,7 +11,6 @@ import (
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/rlp" "github.com/ethereum/go-ethereum/rlp"
"github.com/ethereum/go-ethereum/statediff/indexer/database/sql" "github.com/ethereum/go-ethereum/statediff/indexer/database/sql"
"github.com/ethereum/go-ethereum/statediff/indexer/interfaces" "github.com/ethereum/go-ethereum/statediff/indexer/interfaces"
@ -23,7 +22,6 @@ var (
db sql.Database db sql.Database
err error err error
ind interfaces.StateDiffIndexer ind interfaces.StateDiffIndexer
chainConf = params.MainnetChainConfig
ipfsPgGet = `SELECT data FROM public.blocks ipfsPgGet = `SELECT data FROM public.blocks
WHERE key = $1` WHERE key = $1`
tx1, tx2, tx3, tx4, tx5, rct1, rct2, rct3, rct4, rct5 []byte tx1, tx2, tx3, tx4, tx5, rct1, rct2, rct3, rct4, rct5 []byte

View File

@ -64,7 +64,7 @@ type KnownGapsState struct {
statediffMetrics statediffMetricsHandles statediffMetrics statediffMetricsHandles
} }
// Unused // Create a new KnownGapsState struct, currently unused.
func NewKnownGapsState(checkForGaps bool, processingKey int64, expectedDifference *big.Int, func NewKnownGapsState(checkForGaps bool, processingKey int64, expectedDifference *big.Int,
errorState bool, writeFilePath string, db sql.Database, statediffMetrics statediffMetricsHandles) *KnownGapsState { errorState bool, writeFilePath string, db sql.Database, statediffMetrics statediffMetricsHandles) *KnownGapsState {
@ -111,8 +111,8 @@ func (kg *KnownGapsState) pushKnownGaps(startingBlockNumber *big.Int, endingBloc
} }
log.Info("Updating Metrics for the start and end block") log.Info("Updating Metrics for the start and end block")
//kg.statediffMetrics.knownGapStart.Update(startingBlockNumber.Int64()) kg.statediffMetrics.knownGapStart.Update(startingBlockNumber.Int64())
//kg.statediffMetrics.knownGapEnd.Update(endingBlockNumber.Int64()) kg.statediffMetrics.knownGapEnd.Update(endingBlockNumber.Int64())
var writeErr error var writeErr error
log.Info("Writing known gaps to the DB") log.Info("Writing known gaps to the DB")
@ -227,11 +227,11 @@ func (kg *KnownGapsState) upsertKnownGapsFile(knownGaps models.KnownGapsModel) e
func (kg *KnownGapsState) writeSqlFileStmtToDb() error { func (kg *KnownGapsState) writeSqlFileStmtToDb() error {
log.Info("Writing the local SQL file for KnownGaps to the DB") log.Info("Writing the local SQL file for KnownGaps to the DB")
file, ioErr := ioutil.ReadFile(kg.writeFilePath) file, err := ioutil.ReadFile(kg.writeFilePath)
if ioErr != nil { if err != nil {
log.Error("Unable to open local SQL File for writing") log.Error("Unable to open local SQL File for writing")
return ioErr return err
} }
requests := strings.Split(string(file), ";") requests := strings.Split(string(file), ";")