ipld-eth-server/cmd/run/main.go
Matt K 70cfa20c68 Watch contact updates (#127)
* Downcase all arguments for contact watching

* ABI retrieval from test networks
2018-01-08 15:59:47 -06:00

36 lines
723 B
Go

package main
import (
"flag"
"time"
"os"
"github.com/8thlight/vulcanizedb/cmd"
"github.com/8thlight/vulcanizedb/pkg/geth"
"github.com/8thlight/vulcanizedb/pkg/history"
)
const (
pollingInterval = 7 * time.Second
)
func main() {
environment := flag.String("environment", "", "Environment name")
flag.Parse()
ticker := time.NewTicker(pollingInterval)
defer ticker.Stop()
config := cmd.LoadConfig(*environment)
blockchain := geth.NewBlockchain(config.Client.IPCPath)
repository := cmd.LoadPostgres(config.Database, blockchain.Node())
validator := history.NewBlockValidator(blockchain, repository, 15)
for range ticker.C {
window := validator.ValidateBlocks()
validator.Log(os.Stdout, window)
}
}