70cfa20c68
* Downcase all arguments for contact watching * ABI retrieval from test networks
36 lines
723 B
Go
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)
|
|
}
|
|
}
|