mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 18:32:23 +00:00
eth/fiters: add block timestamp
Signed-off-by: tmelhao <tmelhao@gmail.com>
This commit is contained in:
parent
3999f4a32d
commit
b4f6cd7f03
2 changed files with 3 additions and 2 deletions
|
|
@ -287,7 +287,7 @@ func (f *Filter) checkMatches(ctx context.Context, header *types.Header) ([]*typ
|
|||
// such as tx index, block hash, etc.
|
||||
// Notably tx hash is NOT filled in because it needs
|
||||
// access to block body data.
|
||||
cached, err := f.sys.cachedLogElem(ctx, hash, header.Number.Uint64())
|
||||
cached, err := f.sys.cachedLogElem(ctx, hash, header.Number.Uint64(), header.Time)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ type logCacheElem struct {
|
|||
}
|
||||
|
||||
// cachedLogElem loads block logs from the backend and caches the result.
|
||||
func (sys *FilterSystem) cachedLogElem(ctx context.Context, blockHash common.Hash, number uint64) (*logCacheElem, error) {
|
||||
func (sys *FilterSystem) cachedLogElem(ctx context.Context, blockHash common.Hash, number, time uint64) (*logCacheElem, error) {
|
||||
cached, ok := sys.logsCache.Get(blockHash)
|
||||
if ok {
|
||||
return cached, nil
|
||||
|
|
@ -119,6 +119,7 @@ func (sys *FilterSystem) cachedLogElem(ctx context.Context, blockHash common.Has
|
|||
log.BlockNumber = number
|
||||
log.TxIndex = uint(i)
|
||||
log.Index = logIdx
|
||||
log.BlockTimestamp = time
|
||||
logIdx++
|
||||
flattened = append(flattened, log)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue