* update transformer to able to recheck headers (#4)

* update transformer to able to recheck headers
* put cap on rechecking header
* integration test for recheck headers
* use enum for recheck headers param; make recheck cap configurable
* update integration tests with new test config
* update omni pkg with new recheck header column type
* update migration with new migration tool and final tweaks needed to accommodate changes in omni pkg
This commit is contained in:
Takayuki Goto
2019-02-08 10:35:46 -06:00
committed by GitHub
parent 219f099b0c
commit 0a024d429d
74 changed files with 1994 additions and 222 deletions
+13 -1
View File
@@ -18,7 +18,10 @@ package vat_init
import (
"fmt"
log "github.com/sirupsen/logrus"
"github.com/vulcanize/vulcanizedb/pkg/core"
"github.com/vulcanize/vulcanizedb/pkg/datastore/postgres"
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared"
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants"
@@ -46,7 +49,8 @@ func (repository VatInitRepository) Create(headerID int64, models []interface{})
_, execErr := tx.Exec(
`INSERT INTO maker.vat_init (header_id, ilk, log_idx, tx_idx, raw_log)
VALUES($1, $2, $3, $4, $5)`,
VALUES($1, $2, $3, $4, $5)
ON CONFLICT (header_id, tx_idx, log_idx) DO UPDATE SET ilk = $2, raw_log = $5;`,
headerID, vatInit.Ilk, vatInit.LogIndex, vatInit.TransactionIndex, vatInit.Raw,
)
if execErr != nil {
@@ -74,6 +78,14 @@ func (repository VatInitRepository) MarkHeaderChecked(headerID int64) error {
return shared.MarkHeaderChecked(headerID, repository.db, constants.VatInitChecked)
}
func (repository VatInitRepository) MissingHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) {
return shared.MissingHeaders(startingBlockNumber, endingBlockNumber, repository.db, constants.VatInitChecked)
}
func (repository VatInitRepository) RecheckHeaders(startingBlockNumber, endingBlockNumber int64) ([]core.Header, error) {
return shared.RecheckHeaders(startingBlockNumber, endingBlockNumber, repository.db, constants.VatInitChecked)
}
func (repository *VatInitRepository) SetDB(db *postgres.DB) {
repository.db = db
}