2017-11-06 20:36:12 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"flag"
|
|
|
|
|
|
|
|
"fmt"
|
|
|
|
|
2017-11-09 19:34:58 +00:00
|
|
|
"github.com/8thlight/vulcanizedb/cmd"
|
2017-11-06 20:36:12 +00:00
|
|
|
"github.com/8thlight/vulcanizedb/pkg/geth"
|
|
|
|
"github.com/8thlight/vulcanizedb/pkg/history"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
environment := flag.String("environment", "", "Environment name")
|
|
|
|
startingBlockNumber := flag.Int("starting-number", -1, "First block to fill from")
|
|
|
|
flag.Parse()
|
2017-11-09 19:34:58 +00:00
|
|
|
config := cmd.LoadConfig(*environment)
|
|
|
|
blockchain := geth.NewGethBlockchain(config.Client.IPCPath)
|
2017-12-07 19:32:16 +00:00
|
|
|
repository := cmd.LoadPostgres(config.Database, blockchain.Node())
|
2017-12-19 20:14:41 +00:00
|
|
|
numberOfBlocksCreated := history.PopulateMissingBlocks(blockchain, repository, int64(*startingBlockNumber))
|
2017-11-06 20:36:12 +00:00
|
|
|
fmt.Printf("Populated %d blocks", numberOfBlocksCreated)
|
|
|
|
}
|