forked from maticnetwork/bor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bor_simulated.go
38 lines (31 loc) · 1013 Bytes
/
bor_simulated.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package backends
import (
"context"
"github.com/StevenBarnett1/bor/common"
"github.com/StevenBarnett1/bor/core"
"github.com/StevenBarnett1/bor/core/rawdb"
"github.com/StevenBarnett1/bor/core/types"
"github.com/StevenBarnett1/bor/event"
)
func (fb *filterBackend) GetBorBlockReceipt(ctx context.Context, hash common.Hash) (*types.Receipt, error) {
number := rawdb.ReadHeaderNumber(fb.db, hash)
if number == nil {
return nil, nil
}
receipt := rawdb.ReadRawBorReceipt(fb.db, hash, *number)
if receipt == nil {
return nil, nil
}
return receipt, nil
}
func (fb *filterBackend) GetBorBlockLogs(ctx context.Context, hash common.Hash) ([]*types.Log, error) {
receipt, err := fb.GetBorBlockReceipt(ctx, hash)
if err != nil || receipt == nil {
return nil, err
}
return receipt.Logs, nil
}
// SubscribeStateSyncEvent subscribes to state sync events
func (fb *filterBackend) SubscribeStateSyncEvent(ch chan<- core.StateSyncEvent) event.Subscription {
return fb.bc.SubscribeStateSyncEvent(ch)
}