rpcademon: changed erigon_getLogs() according changes done on erigon_getLatest() (#8417)

This commit is contained in:
lupin012 2023-10-12 09:18:21 +02:00 committed by GitHub
parent 2a760e9c02
commit 02032ada42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -64,12 +64,13 @@ func (api *ErigonImpl) GetLogs(ctx context.Context, crit filters.FilterCriteria)
defer tx.Rollback() defer tx.Rollback()
if crit.BlockHash != nil { if crit.BlockHash != nil {
number := rawdb.ReadHeaderNumber(tx, *crit.BlockHash) header, err := api._blockReader.HeaderByHash(ctx, tx, *crit.BlockHash)
if number == nil { if header == nil {
return nil, fmt.Errorf("block not found: %x", *crit.BlockHash) return nil, err
} }
begin = *number begin = header.Number.Uint64()
end = *number end = header.Number.Uint64()
} else { } else {
// Convert the RPC block numbers into internal representations // Convert the RPC block numbers into internal representations
latest, err := rpchelper.GetLatestBlockNumber(tx) latest, err := rpchelper.GetLatestBlockNumber(tx)
@ -77,7 +78,7 @@ func (api *ErigonImpl) GetLogs(ctx context.Context, crit filters.FilterCriteria)
return nil, err return nil, err
} }
begin = latest begin = 0
if crit.FromBlock != nil { if crit.FromBlock != nil {
if crit.FromBlock.Sign() >= 0 { if crit.FromBlock.Sign() >= 0 {
begin = crit.FromBlock.Uint64() begin = crit.FromBlock.Uint64()