mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-28 07:36:44 +00:00
new: add filter for block logs
This commit is contained in:
parent
432749d6a1
commit
4dae6739f9
1 changed files with 30 additions and 0 deletions
30
eth/filters/bor_filter_system_test.go
Normal file
30
eth/filters/bor_filter_system_test.go
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
package filters
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/maticnetwork/bor/common"
|
||||
"github.com/maticnetwork/bor/core/rawdb"
|
||||
"github.com/maticnetwork/bor/core/types"
|
||||
)
|
||||
|
||||
func (b *testBackend) GetBorBlockReceipt(ctx context.Context, hash common.Hash) (*types.BorReceipt, error) {
|
||||
number := rawdb.ReadHeaderNumber(b.db, hash)
|
||||
if number == nil {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
receipt := rawdb.ReadBorReceipt(b.db, hash, *number)
|
||||
if receipt == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return receipt, nil
|
||||
}
|
||||
|
||||
func (b *testBackend) GetBorBlockLogs(ctx context.Context, hash common.Hash) ([]*types.Log, error) {
|
||||
receipt, err := b.GetBorBlockReceipt(ctx, hash)
|
||||
if receipt == nil || err != nil {
|
||||
return nil, nil
|
||||
}
|
||||
return receipt.Logs, nil
|
||||
}
|
||||
Loading…
Reference in a new issue