major refactor pt 3

This commit is contained in:
Ian Norden
2020-06-29 19:16:52 -05:00
parent 449d23757e
commit e2bcc06f8a
49 changed files with 557 additions and 646 deletions
+3 -4
View File
@@ -22,12 +22,12 @@ import (
"github.com/sirupsen/logrus"
"github.com/vulcanize/ipfs-blockchain-watcher/pkg/config"
"github.com/vulcanize/ipfs-blockchain-watcher/pkg/core"
"github.com/vulcanize/ipfs-blockchain-watcher/pkg/node"
"github.com/vulcanize/ipfs-blockchain-watcher/pkg/postgres"
"github.com/vulcanize/ipfs-blockchain-watcher/pkg/shared"
)
func LoadPostgres(database config.Database, node core.Node) postgres.DB {
func LoadPostgres(database config.Database, node node.Node) postgres.DB {
db, err := postgres.NewDB(database, node)
if err != nil {
logrus.Fatal("Error loading postgres: ", err)
@@ -45,8 +45,7 @@ func GetBlockHeightBins(startingBlock, endingBlock, batchSize uint64) ([][]uint6
}
length := endingBlock - startingBlock + 1
numberOfBins := length / batchSize
remainder := length % batchSize
if remainder != 0 {
if length%batchSize != 0 {
numberOfBins++
}
blockRangeBins := make([][]uint64, numberOfBins)