Add WriteStateSnapshot #15
@ -48,16 +48,16 @@ type Config struct {
|
|||||||
SubtrieWorkers uint
|
SubtrieWorkers uint
|
||||||
// Should the statediff service wait until geth has synced to the head of the blockchain?
|
// Should the statediff service wait until geth has synced to the head of the blockchain?
|
||||||
WaitForSync bool
|
WaitForSync bool
|
||||||
// Context used during DB initialization
|
// Context passed to all DB method calls
|
||||||
Context context.Context
|
Context context.Context
|
||||||
}
|
}
|
||||||
|
|
||||||
// Params contains config parameters for the state diff builder
|
// Params contains config parameters for the state diff builder
|
||||||
type Params struct {
|
type Params struct {
|
||||||
IncludeBlock bool
|
IncludeBlock bool // TODO: not used in write-requests
|
||||||
IncludeReceipts bool
|
IncludeReceipts bool
|
||||||
IncludeTD bool
|
IncludeTD bool
|
||||||
IncludeCode bool
|
IncludeCode bool // TODO: not used by anything?
|
||||||
WatchedAddresses []common.Address
|
WatchedAddresses []common.Address
|
||||||
watchedAddressesLeafPaths [][]byte
|
watchedAddressesLeafPaths [][]byte
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,16 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// NewStateDiffIndexer creates and returns an implementation of the StateDiffIndexer interface.
|
// NewStateDiffIndexer creates and returns an implementation of the StateDiffIndexer interface.
|
||||||
func NewStateDiffIndexer(ctx context.Context, chainConfig *params.ChainConfig, nodeInfo node.Info, config interfaces.Config) (sql.Database, interfaces.StateDiffIndexer, error) {
|
func NewStateDiffIndexer(
|
||||||
|
ctx context.Context,
|
||||||
|
chainConfig *params.ChainConfig,
|
||||||
|
nodeInfo node.Info,
|
||||||
|
config interfaces.Config,
|
||||||
|
) (
|
||||||
|
sql.Database,
|
||||||
|
interfaces.StateDiffIndexer,
|
||||||
|
error,
|
||||||
|
) {
|
||||||
switch config.Type() {
|
switch config.Type() {
|
||||||
case shared.FILE:
|
case shared.FILE:
|
||||||
log.Info("Starting statediff service in SQL file writing mode")
|
log.Info("Starting statediff service in SQL file writing mode")
|
||||||
|
@ -47,8 +47,12 @@ func InitializeNode(stack core.Node, b core.Backend) {
|
|||||||
ClientName: serviceConfig.ClientName,
|
ClientName: serviceConfig.ClientName,
|
||||||
}
|
}
|
||||||
var err error
|
var err error
|
||||||
_, indexer, err = ind.NewStateDiffIndexer(serviceConfig.Context,
|
_, indexer, err = ind.NewStateDiffIndexer(
|
||||||
adapt.ChainConfig(backend.ChainConfig()), info, serviceConfig.IndexerConfig)
|
serviceConfig.Context,
|
||||||
|
adapt.ChainConfig(backend.ChainConfig()),
|
||||||
|
info,
|
||||||
|
serviceConfig.IndexerConfig,
|
||||||
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("failed to construct indexer", "error", err)
|
log.Error("failed to construct indexer", "error", err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user