Update price feeds if header changed by validator

- currently not validating price feeds if the underlying header already exists
  and is valid, since price feeds should have been added when initial header
  was added
This commit is contained in:
Rob Mulholand
2018-08-16 11:22:16 -05:00
parent 6e68dc4a92
commit 72a849a272
10 changed files with 65 additions and 13 deletions
+1 -1
View File
@@ -97,7 +97,7 @@ func lightSync() {
db := utils.LoadPostgres(databaseConfig, blockChain.Node())
headerRepository := repositories.NewHeaderRepository(&db)
validator := history.NewHeaderValidator(blockChain, headerRepository, validationWindow)
validator := history.NewHeaderValidator(blockChain, headerRepository, validationWindow, []transformers.Transformer{})
missingBlocksPopulated := make(chan int)
go backFillAllHeaders(blockChain, headerRepository, missingBlocksPopulated, startingBlockNumber)
+1 -2
View File
@@ -89,14 +89,13 @@ func syncPriceFeeds() {
db := utils.LoadPostgres(databaseConfig, blockChain.Node())
headerRepository := repositories.NewHeaderRepository(&db)
// TODO: add transformers to validation so we don't miss events on new block headers
validator := history.NewHeaderValidator(blockChain, headerRepository, validationWindow)
missingBlocksPopulated := make(chan int)
transformers := []transformers.Transformer{
pep.NewPepTransformer(blockChain, &db),
pip.NewPipTransformer(blockChain, &db),
rep.NewRepTransformer(blockChain, &db),
}
validator := history.NewHeaderValidator(blockChain, headerRepository, validationWindow, transformers)
go backFillPriceFeeds(blockChain, headerRepository, missingBlocksPopulated, startingBlockNumber, transformers)
for {