forked from cerc-io/ipld-eth-server
Add error propagation and test todos for watcher
This commit is contained in:
parent
2d81861ae5
commit
e03ccb094f
@ -56,12 +56,17 @@ func (watcher *Watcher) Execute() error {
|
|||||||
|
|
||||||
// TODO Handle start and end numbers in transformers?
|
// TODO Handle start and end numbers in transformers?
|
||||||
missingHeaders, err := shared.MissingHeaders(0, -1, watcher.DB, notCheckedSQL)
|
missingHeaders, err := shared.MissingHeaders(0, -1, watcher.DB, notCheckedSQL)
|
||||||
|
if err != nil {
|
||||||
|
log.Error("Fetching of missing headers failed in watcher!")
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
for _, header := range missingHeaders {
|
for _, header := range missingHeaders {
|
||||||
// TODO Extend FetchLogs for doing several blocks at a time
|
// TODO Extend FetchLogs for doing several blocks at a time
|
||||||
logs, err := watcher.Fetcher.FetchLogs(watcher.Addresses, watcher.Topics, header)
|
logs, err := watcher.Fetcher.FetchLogs(watcher.Addresses, watcher.Topics, header)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// TODO Handle fetch error in watcher
|
// TODO Handle fetch error in watcher
|
||||||
|
log.Error("Error while fetching logs in watcher")
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,10 +41,9 @@ func fakeTransformerInitializer(db *postgres.DB) shared2.Transformer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var _ = Describe("Watcher", func() {
|
var _ = Describe("Watcher", func() {
|
||||||
// TODO Add test for watcher setting the BC
|
It("initialises correctly", func() {
|
||||||
// TODO Add tests for log chunk delegation
|
// TODO Test watcher initialisation
|
||||||
// TODO Add tests for aggregate fetching
|
})
|
||||||
// TODO Add tests for MissingHeaders
|
|
||||||
|
|
||||||
It("adds transformers", func() {
|
It("adds transformers", func() {
|
||||||
watcher := shared.Watcher{}
|
watcher := shared.Watcher{}
|
||||||
@ -102,5 +101,25 @@ var _ = Describe("Watcher", func() {
|
|||||||
Expect(err).To(HaveOccurred())
|
Expect(err).To(HaveOccurred())
|
||||||
Expect(fakeTransformer.executeWasCalled).To(BeFalse())
|
Expect(fakeTransformer.executeWasCalled).To(BeFalse())
|
||||||
})
|
})
|
||||||
|
|
||||||
|
It("calls MissingHeaders", func() {
|
||||||
|
// TODO Tests for calling MissingHeaders
|
||||||
|
})
|
||||||
|
|
||||||
|
It("returns an error if missingHeaders returns an error", func() {
|
||||||
|
// TODO Test for propagating missingHeaders error
|
||||||
|
})
|
||||||
|
|
||||||
|
It("calls the log fetcher", func() {
|
||||||
|
// TODO Test for calling FetchLogs
|
||||||
|
})
|
||||||
|
|
||||||
|
It("returns an error if the log fetcher returns an error", func() {
|
||||||
|
// TODO Test for propagating log fetcher error
|
||||||
|
})
|
||||||
|
|
||||||
|
It("passes only relevant logs to each transformer", func() {
|
||||||
|
// TODO Test log delegation
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user