Cleanup fetcher and add test todos

This commit is contained in:
Edvard 2018-12-10 21:12:55 +01:00
parent e03ccb094f
commit 83593cb5f2
2 changed files with 7 additions and 11 deletions

View File

@ -22,25 +22,14 @@ import (
"github.com/vulcanize/vulcanizedb/pkg/core"
)
// TODO Check if Fetcher can be simplified with aggregate logic
type LogFetcher interface {
FetchLogs(contractAddresses []common.Address, topics []common.Hash, missingHeader core.Header) ([]types.Log, error)
}
type SettableLogFetcher interface {
LogFetcher
SetBC(bc core.BlockChain)
}
type Fetcher struct {
blockChain core.BlockChain
}
func (fetcher *Fetcher) SetBC(bc core.BlockChain) {
fetcher.blockChain = bc
}
func NewFetcher(blockchain core.BlockChain) Fetcher {
return Fetcher{
blockChain: blockchain,

View File

@ -26,7 +26,14 @@ import (
)
var _ = Describe("Fetcher", func() {
Describe("Iinitialisation", func() {
It("creates correct lookup maps", func() {
})
})
Describe("FetchLogs", func() {
// TODO Add tests for aggregate fetching
It("fetches logs based on the given query", func() {
blockChain := fakes.NewMockBlockChain()
fetcher := shared.NewFetcher(blockChain)