Cleanup fetcher and add test todos
This commit is contained in:
parent
e03ccb094f
commit
83593cb5f2
@ -22,25 +22,14 @@ import (
|
|||||||
"github.com/vulcanize/vulcanizedb/pkg/core"
|
"github.com/vulcanize/vulcanizedb/pkg/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TODO Check if Fetcher can be simplified with aggregate logic
|
|
||||||
|
|
||||||
type LogFetcher interface {
|
type LogFetcher interface {
|
||||||
FetchLogs(contractAddresses []common.Address, topics []common.Hash, missingHeader core.Header) ([]types.Log, error)
|
FetchLogs(contractAddresses []common.Address, topics []common.Hash, missingHeader core.Header) ([]types.Log, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type SettableLogFetcher interface {
|
|
||||||
LogFetcher
|
|
||||||
SetBC(bc core.BlockChain)
|
|
||||||
}
|
|
||||||
|
|
||||||
type Fetcher struct {
|
type Fetcher struct {
|
||||||
blockChain core.BlockChain
|
blockChain core.BlockChain
|
||||||
}
|
}
|
||||||
|
|
||||||
func (fetcher *Fetcher) SetBC(bc core.BlockChain) {
|
|
||||||
fetcher.blockChain = bc
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewFetcher(blockchain core.BlockChain) Fetcher {
|
func NewFetcher(blockchain core.BlockChain) Fetcher {
|
||||||
return Fetcher{
|
return Fetcher{
|
||||||
blockChain: blockchain,
|
blockChain: blockchain,
|
||||||
|
@ -26,7 +26,14 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var _ = Describe("Fetcher", func() {
|
var _ = Describe("Fetcher", func() {
|
||||||
|
Describe("Iinitialisation", func() {
|
||||||
|
It("creates correct lookup maps", func() {
|
||||||
|
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
Describe("FetchLogs", func() {
|
Describe("FetchLogs", func() {
|
||||||
|
// TODO Add tests for aggregate fetching
|
||||||
It("fetches logs based on the given query", func() {
|
It("fetches logs based on the given query", func() {
|
||||||
blockChain := fakes.NewMockBlockChain()
|
blockChain := fakes.NewMockBlockChain()
|
||||||
fetcher := shared.NewFetcher(blockChain)
|
fetcher := shared.NewFetcher(blockChain)
|
||||||
|
Loading…
Reference in New Issue
Block a user