@@ -56,6 +56,29 @@ func (b *testBackend) ChainDb() ctxcdb.Database {
5656 return b .db
5757}
5858
59+ func (b * testBackend ) CurrentHeader () * types.Header {
60+ hdr , _ := b .HeaderByNumber (context .TODO (), rpc .LatestBlockNumber )
61+ return hdr
62+ }
63+
64+ func (b * testBackend ) CurrentBlock () * types.Header {
65+ return b .CurrentHeader ()
66+ }
67+
68+ func (b * testBackend ) GetCanonicalHash (number uint64 ) common.Hash {
69+ return rawdb .ReadCanonicalHash (b .db , number )
70+ }
71+
72+ func (b * testBackend ) GetHeader (hash common.Hash , number uint64 ) * types.Header {
73+ hdr , _ := b .HeaderByHash (context .Background (), hash )
74+ return hdr
75+ }
76+
77+ func (b * testBackend ) GetReceiptsByHash (hash common.Hash ) types.Receipts {
78+ r , _ := b .GetReceipts (context .Background (), hash )
79+ return r
80+ }
81+
5982func (b * testBackend ) HeaderByNumber (ctx context.Context , blockNr rpc.BlockNumber ) (* types.Header , error ) {
6083 var (
6184 hash common.Hash
@@ -162,7 +185,10 @@ func (b *testBackend) ServiceFilter(ctx context.Context, session *bloombits.Matc
162185 }()
163186}
164187
165- func (b * testBackend ) CurrentView () * filtermaps.ChainView { return nil }
188+ func (b * testBackend ) CurrentView () * filtermaps.ChainView {
189+ head := b .CurrentBlock ()
190+ return filtermaps .NewChainView (b , head .Number .Uint64 (), head .Hash ())
191+ }
166192
167193func newTestFilterSystem (t testing.TB , db ctxcdb.Database , cfg Config ) (* testBackend , * FilterSystem ) {
168194 backend := & testBackend {db : db }
0 commit comments