Bound the filter of init SC events by blocks

When querying the init event for each smart contract, bound the search from
block genesis-24h to block genesis.  Otherwise, this query in geth synced to
mainnet takes too long.
This commit is contained in:
Eduard S
2021-03-22 17:22:24 +01:00
parent 2184084408
commit aa82efc868
9 changed files with 35 additions and 18 deletions

View File

@@ -704,15 +704,15 @@ func (s *Synchronizer) reorg(uncleBlock *common.Block) (int64, error) {
func getInitialVariables(ethClient eth.ClientInterface,
consts *common.SCConsts) (*common.SCVariables, *StartBlockNums, error) {
rollupInit, rollupInitBlock, err := ethClient.RollupEventInit()
rollupInit, rollupInitBlock, err := ethClient.RollupEventInit(consts.Auction.GenesisBlockNum)
if err != nil {
return nil, nil, tracerr.Wrap(fmt.Errorf("RollupEventInit: %w", err))
}
auctionInit, auctionInitBlock, err := ethClient.AuctionEventInit()
auctionInit, auctionInitBlock, err := ethClient.AuctionEventInit(consts.Auction.GenesisBlockNum)
if err != nil {
return nil, nil, tracerr.Wrap(fmt.Errorf("AuctionEventInit: %w", err))
}
wDelayerInit, wDelayerInitBlock, err := ethClient.WDelayerEventInit()
wDelayerInit, wDelayerInitBlock, err := ethClient.WDelayerEventInit(consts.Auction.GenesisBlockNum)
if err != nil {
return nil, nil, tracerr.Wrap(fmt.Errorf("WDelayerEventInit: %w", err))
}