Add ability to populate missing blocks

* The command populates up to the highest known block number
 * The anticipated use case is that the listener will be running
   in parallel to the populateBlocks command
    * This will mean that the listener is responsible for picking up
      new blocks, and the populateBlocks command is reposible for
      historical blocks
 * Reformat SQL statements
This commit is contained in:
Eric Meyer
2017-11-08 14:52:38 -06:00
parent cdc861e5f2
commit 4c84173bc0
15 changed files with 315 additions and 19 deletions
+10
View File
@@ -25,6 +25,16 @@ func tasks(p *do.Project) {
do.M{"environment": environment, "$in": "cmd/run"})
})
p.Task("populateBlocks", nil, func(context *do.Context) {
environment := parseEnvironment(context)
startingNumber := context.Args.MayInt(-1, "starting-number")
if startingNumber < 0 {
log.Fatalln("--starting-number required")
}
context.Start(`go run main.go --environment={{.environment}} --starting-number={{.startingNumber}}`,
do.M{"environment": environment, "startingNumber": startingNumber, "$in": "cmd/populate_blocks"})
})
p.Task("migrate", nil, func(context *do.Context) {
environment := parseEnvironment(context)
cfg := config.NewConfig(environment)