Initial plugin implementation
* refactor packages, flags, subscriptions * DRY refactor builder tests * use mockgen to generate mocks * update README * MODE=statediff no longer needed for unit tests * simplify func names, clean up metrics * move write params to service field * sql indexer: confirm quit after ipld cache reset prevents negative waitgroup panic * don't let TotalDifficulty become nil * use forked plugeth, plugeth-utils for now
This commit is contained in:
@@ -28,7 +28,7 @@ const (
|
||||
POSTGRES DBType = "Postgres"
|
||||
DUMP DBType = "Dump"
|
||||
FILE DBType = "File"
|
||||
UNKNOWN DBType = "Unknown"
|
||||
INVALID DBType = "Invalid"
|
||||
)
|
||||
|
||||
// ResolveDBType resolves a DBType from a provided string
|
||||
@@ -41,6 +41,17 @@ func ResolveDBType(str string) (DBType, error) {
|
||||
case "file", "f", "fs":
|
||||
return FILE, nil
|
||||
default:
|
||||
return UNKNOWN, fmt.Errorf("unrecognized db type string: %s", str)
|
||||
return INVALID, fmt.Errorf("unrecognized db type string: %s", str)
|
||||
}
|
||||
}
|
||||
|
||||
// Set satisfies flag.Value
|
||||
func (dbt *DBType) Set(v string) (err error) {
|
||||
*dbt, err = ResolveDBType(v)
|
||||
return
|
||||
}
|
||||
|
||||
// String satisfies flag.Value
|
||||
func (dbt *DBType) String() string {
|
||||
return strings.ToLower(string(*dbt))
|
||||
}
|
||||
|
||||
@@ -25,13 +25,13 @@ func HandleZeroAddrPointer(to *common.Address) string {
|
||||
if to == nil {
|
||||
return ""
|
||||
}
|
||||
return to.Hex()
|
||||
return to.String()
|
||||
}
|
||||
|
||||
// HandleZeroAddr will return an empty string for a 0 value address
|
||||
func HandleZeroAddr(to common.Address) string {
|
||||
if to.Hex() == "0x0000000000000000000000000000000000000000" {
|
||||
if to == (common.Address{}) {
|
||||
return ""
|
||||
}
|
||||
return to.Hex()
|
||||
return to.String()
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
. "github.com/ethereum/go-ethereum/statediff/indexer/shared/schema"
|
||||
. "github.com/cerc-io/plugeth-statediff/indexer/shared/schema"
|
||||
)
|
||||
|
||||
var testHeaderTable = Table{
|
||||
|
||||
Reference in New Issue
Block a user