mirror of
https://github.com/arnaucube/hermez-node.git
synced 2026-02-07 03:16:45 +01:00
Merge pull request #365 from hermeznetwork/feature/nodecfg
Merge node (sync-only) and coord config
This commit is contained in:
@@ -93,3 +93,46 @@ TokenHEZName = "Hermez Network Token"
|
|||||||
Withdrawals = 0
|
Withdrawals = 0
|
||||||
BlockWithdrawalRate = 0
|
BlockWithdrawalRate = 0
|
||||||
MaxWithdrawals = 0
|
MaxWithdrawals = 0
|
||||||
|
|
||||||
|
|
||||||
|
[Coordinator]
|
||||||
|
ForgerAddress = "0x6BB84Cc84D4A34467aD12a2039A312f7029e2071"
|
||||||
|
ConfirmBlocks = 10
|
||||||
|
L1BatchTimeoutPerc = 0.6
|
||||||
|
ProofServerPollInterval = "1s"
|
||||||
|
SyncRetryInterval = "1s"
|
||||||
|
|
||||||
|
[Coordinator.L2DB]
|
||||||
|
SafetyPeriod = 10
|
||||||
|
MaxTxs = 512
|
||||||
|
TTL = "24h"
|
||||||
|
PurgeBatchDelay = 10
|
||||||
|
InvalidateBatchDelay = 20
|
||||||
|
PurgeBlockDelay = 10
|
||||||
|
InvalidateBlockDelay = 20
|
||||||
|
|
||||||
|
[Coordinator.TxSelector]
|
||||||
|
Path = "/tmp/iden3-test/hermez/txselector"
|
||||||
|
|
||||||
|
[Coordinator.BatchBuilder]
|
||||||
|
Path = "/tmp/iden3-test/hermez/batchbuilder"
|
||||||
|
|
||||||
|
[[Coordinator.ServerProofs]]
|
||||||
|
URL = "http://localhost:3000"
|
||||||
|
|
||||||
|
[Coordinator.EthClient]
|
||||||
|
CallGasLimit = 300000
|
||||||
|
DeployGasLimit = 1000000
|
||||||
|
GasPriceDiv = 100
|
||||||
|
ReceiptTimeout = "60s"
|
||||||
|
ReceiptLoopInterval = "500ms"
|
||||||
|
|
||||||
|
CheckLoopInterval = "500ms"
|
||||||
|
Attempts = 8
|
||||||
|
AttemptsDelay = "200ms"
|
||||||
|
|
||||||
|
[Coordinator.API]
|
||||||
|
Coordinator = true
|
||||||
|
|
||||||
|
[Coordinator.Debug]
|
||||||
|
BatchPath = "/tmp/iden3-test/hermez/batchesdebug"
|
||||||
|
|||||||
@@ -1,33 +0,0 @@
|
|||||||
[StateDB]
|
|
||||||
Path = "/tmp/iden3-test/hermez/statedb"
|
|
||||||
|
|
||||||
[PostgreSQL]
|
|
||||||
Port = 5432
|
|
||||||
Host = "localhost"
|
|
||||||
User = "hermez"
|
|
||||||
Password = "yourpasswordhere"
|
|
||||||
Name = "hermez"
|
|
||||||
|
|
||||||
[L2DB]
|
|
||||||
SafetyPeriod = 10
|
|
||||||
MaxTxs = 512
|
|
||||||
TTL = "24h"
|
|
||||||
|
|
||||||
[Web3]
|
|
||||||
URL = "XXX"
|
|
||||||
|
|
||||||
[Synchronizer]
|
|
||||||
SyncLoopInterval = "1s"
|
|
||||||
|
|
||||||
[SmartContracts]
|
|
||||||
Rollup = "0xEcc0a6dbC0bb4D51E4F84A315a9e5B0438cAD4f0"
|
|
||||||
Auction = "0x500D1d6A4c7D8Ae28240b47c8FCde034D827fD5e"
|
|
||||||
TokenHEZ = "0xf784709d2317D872237C4bC22f867d1BAe2913AB"
|
|
||||||
TokenHEZName = "Hermez Network Token"
|
|
||||||
|
|
||||||
[EthClient]
|
|
||||||
CallGasLimit = 300000
|
|
||||||
DeployGasLimit = 1000000
|
|
||||||
GasPriceDiv = 100
|
|
||||||
ReceiptTimeout = "60s"
|
|
||||||
IntervalReceiptLoop = "200ms"
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
ForgerAddress = "0x6BB84Cc84D4A34467aD12a2039A312f7029e2071"
|
|
||||||
ConfirmBlocks = 10
|
|
||||||
L1BatchTimeoutPerc = 0.6
|
|
||||||
ProofServerPollInterval = "1s"
|
|
||||||
SyncRetryInterval = "1s"
|
|
||||||
|
|
||||||
[L2DB]
|
|
||||||
SafetyPeriod = 10
|
|
||||||
MaxTxs = 512
|
|
||||||
TTL = "24h"
|
|
||||||
PurgeBatchDelay = 10
|
|
||||||
InvalidateBatchDelay = 20
|
|
||||||
PurgeBlockDelay = 10
|
|
||||||
InvalidateBlockDelay = 20
|
|
||||||
|
|
||||||
[TxSelector]
|
|
||||||
Path = "/tmp/iden3-test/hermez/txselector"
|
|
||||||
|
|
||||||
[BatchBuilder]
|
|
||||||
Path = "/tmp/iden3-test/hermez/batchbuilder"
|
|
||||||
|
|
||||||
[[ServerProofs]]
|
|
||||||
URL = "http://localhost:3000"
|
|
||||||
|
|
||||||
[EthClient]
|
|
||||||
CallGasLimit = 300000
|
|
||||||
DeployGasLimit = 1000000
|
|
||||||
GasPriceDiv = 100
|
|
||||||
ReceiptTimeout = "60s"
|
|
||||||
ReceiptLoopInterval = "500ms"
|
|
||||||
|
|
||||||
CheckLoopInterval = "500ms"
|
|
||||||
Attempts = 8
|
|
||||||
AttemptsDelay = "200ms"
|
|
||||||
|
|
||||||
[API]
|
|
||||||
Coordinator = true
|
|
||||||
|
|
||||||
[Debug]
|
|
||||||
BatchPath = "/tmp/iden3-test/hermez/batchesdebug"
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
ForgerAddress = "0x6BB84Cc84D4A34467aD12a2039A312f7029e2071"
|
|
||||||
ForgerLoopInterval = "500ms"
|
|
||||||
|
|
||||||
[EthClient]
|
|
||||||
CallGasLimit = 300000
|
|
||||||
DeployGasLimit = 1000000
|
|
||||||
GasPriceDiv = 100
|
|
||||||
ReceiptTimeout = "60s"
|
|
||||||
IntervalReceiptLoop = "200ms"
|
|
||||||
|
|
||||||
[L2DB]
|
|
||||||
SafetyPeriod = 10
|
|
||||||
MaxTxs = 512
|
|
||||||
TTL = "24h"
|
|
||||||
@@ -13,11 +13,10 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
flagCfg = "cfg"
|
flagCfg = "cfg"
|
||||||
flagCoordCfg = "coordcfg"
|
flagMode = "mode"
|
||||||
flagMode = "mode"
|
modeSync = "sync"
|
||||||
modeSync = "sync"
|
modeCoord = "coord"
|
||||||
modeCoord = "coord"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func cmdInit(c *cli.Context) error {
|
func cmdInit(c *cli.Context) error {
|
||||||
@@ -35,7 +34,7 @@ func cmdRun(c *cli.Context) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return tracerr.Wrap(fmt.Errorf("error parsing flags and config: %w", err))
|
return tracerr.Wrap(fmt.Errorf("error parsing flags and config: %w", err))
|
||||||
}
|
}
|
||||||
node, err := node.NewNode(cfg.mode, cfg.node, cfg.coord)
|
node, err := node.NewNode(cfg.mode, cfg.node)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return tracerr.Wrap(fmt.Errorf("error starting node: %w", err))
|
return tracerr.Wrap(fmt.Errorf("error starting node: %w", err))
|
||||||
}
|
}
|
||||||
@@ -61,9 +60,8 @@ func cmdRun(c *cli.Context) error {
|
|||||||
|
|
||||||
// Config is the configuration of the hermez node execution
|
// Config is the configuration of the hermez node execution
|
||||||
type Config struct {
|
type Config struct {
|
||||||
mode node.Mode
|
mode node.Mode
|
||||||
node *config.Node
|
node *config.Node
|
||||||
coord *config.Coordinator
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func parseCli(c *cli.Context) (*Config, error) {
|
func parseCli(c *cli.Context) (*Config, error) {
|
||||||
@@ -80,36 +78,27 @@ func parseCli(c *cli.Context) (*Config, error) {
|
|||||||
func getConfig(c *cli.Context) (*Config, error) {
|
func getConfig(c *cli.Context) (*Config, error) {
|
||||||
var cfg Config
|
var cfg Config
|
||||||
mode := c.String(flagMode)
|
mode := c.String(flagMode)
|
||||||
switch mode {
|
|
||||||
case modeSync:
|
|
||||||
cfg.mode = node.ModeSynchronizer
|
|
||||||
case modeCoord:
|
|
||||||
cfg.mode = node.ModeCoordinator
|
|
||||||
default:
|
|
||||||
return nil, tracerr.Wrap(fmt.Errorf("invalid mode \"%v\"", mode))
|
|
||||||
}
|
|
||||||
|
|
||||||
if cfg.mode == node.ModeCoordinator {
|
|
||||||
coordCfgPath := c.String(flagCoordCfg)
|
|
||||||
if coordCfgPath == "" {
|
|
||||||
return nil, tracerr.Wrap(fmt.Errorf("required flag \"%v\" not set", flagCoordCfg))
|
|
||||||
}
|
|
||||||
coordCfg, err := config.LoadCoordinator(coordCfgPath)
|
|
||||||
if err != nil {
|
|
||||||
return nil, tracerr.Wrap(err)
|
|
||||||
}
|
|
||||||
cfg.coord = coordCfg
|
|
||||||
}
|
|
||||||
nodeCfgPath := c.String(flagCfg)
|
nodeCfgPath := c.String(flagCfg)
|
||||||
if nodeCfgPath == "" {
|
if nodeCfgPath == "" {
|
||||||
return nil, tracerr.Wrap(fmt.Errorf("required flag \"%v\" not set", flagCfg))
|
return nil, tracerr.Wrap(fmt.Errorf("required flag \"%v\" not set", flagCfg))
|
||||||
}
|
}
|
||||||
nodeCfg, err := config.LoadNode(nodeCfgPath)
|
var err error
|
||||||
if err != nil {
|
switch mode {
|
||||||
return nil, tracerr.Wrap(err)
|
case modeSync:
|
||||||
|
cfg.mode = node.ModeSynchronizer
|
||||||
|
cfg.node, err = config.LoadNode(nodeCfgPath)
|
||||||
|
if err != nil {
|
||||||
|
return nil, tracerr.Wrap(err)
|
||||||
|
}
|
||||||
|
case modeCoord:
|
||||||
|
cfg.mode = node.ModeCoordinator
|
||||||
|
cfg.node, err = config.LoadCoordinator(nodeCfgPath)
|
||||||
|
if err != nil {
|
||||||
|
return nil, tracerr.Wrap(err)
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
return nil, tracerr.Wrap(fmt.Errorf("invalid mode \"%v\"", mode))
|
||||||
}
|
}
|
||||||
// nodeCfg.Synchronizer.InitialVariables.WDelayer.HermezRollupAddress = nodeCfg.SmartContracts.Rollup
|
|
||||||
cfg.node = nodeCfg
|
|
||||||
|
|
||||||
return &cfg, nil
|
return &cfg, nil
|
||||||
}
|
}
|
||||||
@@ -129,10 +118,6 @@ func main() {
|
|||||||
Usage: "Node configuration `FILE`",
|
Usage: "Node configuration `FILE`",
|
||||||
Required: true,
|
Required: true,
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
|
||||||
Name: flagCoordCfg,
|
|
||||||
Usage: "Coordinator configuration `FILE`",
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
app.Commands = []*cli.Command{
|
app.Commands = []*cli.Command{
|
||||||
|
|||||||
@@ -132,6 +132,7 @@ type Node struct {
|
|||||||
Debug struct {
|
Debug struct {
|
||||||
APIAddress string
|
APIAddress string
|
||||||
}
|
}
|
||||||
|
Coordinator Coordinator `validate:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load loads a generic config.
|
// Load loads a generic config.
|
||||||
@@ -144,18 +145,21 @@ func Load(path string, cfg interface{}) error {
|
|||||||
if _, err := toml.Decode(cfgToml, cfg); err != nil {
|
if _, err := toml.Decode(cfgToml, cfg); err != nil {
|
||||||
return tracerr.Wrap(err)
|
return tracerr.Wrap(err)
|
||||||
}
|
}
|
||||||
validate := validator.New()
|
|
||||||
if err := validate.Struct(cfg); err != nil {
|
|
||||||
return tracerr.Wrap(fmt.Errorf("error validating configuration file: %w", err))
|
|
||||||
}
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// LoadCoordinator loads the Coordinator configuration from path.
|
// LoadCoordinator loads the Coordinator configuration from path.
|
||||||
func LoadCoordinator(path string) (*Coordinator, error) {
|
func LoadCoordinator(path string) (*Node, error) {
|
||||||
var cfg Coordinator
|
var cfg Node
|
||||||
if err := Load(path, &cfg); err != nil {
|
if err := Load(path, &cfg); err != nil {
|
||||||
return nil, tracerr.Wrap(fmt.Errorf("error loading coordinator configuration file: %w", err))
|
return nil, tracerr.Wrap(fmt.Errorf("error loading node configuration file: %w", err))
|
||||||
|
}
|
||||||
|
validate := validator.New()
|
||||||
|
if err := validate.Struct(cfg); err != nil {
|
||||||
|
return nil, tracerr.Wrap(fmt.Errorf("error validating configuration file: %w", err))
|
||||||
|
}
|
||||||
|
if err := validate.Struct(cfg.Coordinator); err != nil {
|
||||||
|
return nil, tracerr.Wrap(fmt.Errorf("error validating configuration file: %w", err))
|
||||||
}
|
}
|
||||||
return &cfg, nil
|
return &cfg, nil
|
||||||
}
|
}
|
||||||
@@ -166,5 +170,9 @@ func LoadNode(path string) (*Node, error) {
|
|||||||
if err := Load(path, &cfg); err != nil {
|
if err := Load(path, &cfg); err != nil {
|
||||||
return nil, tracerr.Wrap(fmt.Errorf("error loading node configuration file: %w", err))
|
return nil, tracerr.Wrap(fmt.Errorf("error loading node configuration file: %w", err))
|
||||||
}
|
}
|
||||||
|
validate := validator.New()
|
||||||
|
if err := validate.Struct(cfg); err != nil {
|
||||||
|
return nil, tracerr.Wrap(fmt.Errorf("error validating configuration file: %w", err))
|
||||||
|
}
|
||||||
return &cfg, nil
|
return &cfg, nil
|
||||||
}
|
}
|
||||||
|
|||||||
58
node/node.go
58
node/node.go
@@ -49,8 +49,7 @@ type Node struct {
|
|||||||
nodeAPI *NodeAPI
|
nodeAPI *NodeAPI
|
||||||
debugAPI *debugapi.DebugAPI
|
debugAPI *debugapi.DebugAPI
|
||||||
// Coordinator
|
// Coordinator
|
||||||
coord *coordinator.Coordinator
|
coord *coordinator.Coordinator
|
||||||
coordCfg *config.Coordinator
|
|
||||||
|
|
||||||
// Synchronizer
|
// Synchronizer
|
||||||
sync *synchronizer.Synchronizer
|
sync *synchronizer.Synchronizer
|
||||||
@@ -65,7 +64,7 @@ type Node struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewNode creates a Node
|
// NewNode creates a Node
|
||||||
func NewNode(mode Mode, cfg *config.Node, coordCfg *config.Coordinator) (*Node, error) {
|
func NewNode(mode Mode, cfg *config.Node) (*Node, error) {
|
||||||
// Stablish DB connection
|
// Stablish DB connection
|
||||||
db, err := dbUtils.InitSQLDB(
|
db, err := dbUtils.InitSQLDB(
|
||||||
cfg.PostgreSQL.Port,
|
cfg.PostgreSQL.Port,
|
||||||
@@ -92,11 +91,11 @@ func NewNode(mode Mode, cfg *config.Node, coordCfg *config.Coordinator) (*Node,
|
|||||||
var ethCfg eth.EthereumConfig
|
var ethCfg eth.EthereumConfig
|
||||||
if mode == ModeCoordinator {
|
if mode == ModeCoordinator {
|
||||||
ethCfg = eth.EthereumConfig{
|
ethCfg = eth.EthereumConfig{
|
||||||
CallGasLimit: coordCfg.EthClient.CallGasLimit,
|
CallGasLimit: cfg.Coordinator.EthClient.CallGasLimit,
|
||||||
DeployGasLimit: coordCfg.EthClient.DeployGasLimit,
|
DeployGasLimit: cfg.Coordinator.EthClient.DeployGasLimit,
|
||||||
GasPriceDiv: coordCfg.EthClient.GasPriceDiv,
|
GasPriceDiv: cfg.Coordinator.EthClient.GasPriceDiv,
|
||||||
ReceiptTimeout: coordCfg.EthClient.ReceiptTimeout.Duration,
|
ReceiptTimeout: cfg.Coordinator.EthClient.ReceiptTimeout.Duration,
|
||||||
IntervalReceiptLoop: coordCfg.EthClient.ReceiptLoopInterval.Duration,
|
IntervalReceiptLoop: cfg.Coordinator.EthClient.ReceiptLoopInterval.Duration,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
client, err := eth.NewClient(ethClient, nil, nil, ð.ClientConfig{
|
client, err := eth.NewClient(ethClient, nil, nil, ð.ClientConfig{
|
||||||
@@ -140,45 +139,45 @@ func NewNode(mode Mode, cfg *config.Node, coordCfg *config.Coordinator) (*Node,
|
|||||||
if mode == ModeCoordinator {
|
if mode == ModeCoordinator {
|
||||||
l2DB = l2db.NewL2DB(
|
l2DB = l2db.NewL2DB(
|
||||||
db,
|
db,
|
||||||
coordCfg.L2DB.SafetyPeriod,
|
cfg.Coordinator.L2DB.SafetyPeriod,
|
||||||
coordCfg.L2DB.MaxTxs,
|
cfg.Coordinator.L2DB.MaxTxs,
|
||||||
coordCfg.L2DB.TTL.Duration,
|
cfg.Coordinator.L2DB.TTL.Duration,
|
||||||
)
|
)
|
||||||
// TODO: Get (maxL1UserTxs, maxL1OperatorTxs, maxTxs) from the smart contract
|
// TODO: Get (maxL1UserTxs, maxL1OperatorTxs, maxTxs) from the smart contract
|
||||||
txSelector, err := txselector.NewTxSelector(coordCfg.TxSelector.Path, stateDB, l2DB, 10, 10, 10)
|
txSelector, err := txselector.NewTxSelector(cfg.Coordinator.TxSelector.Path, stateDB, l2DB, 10, 10, 10)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, tracerr.Wrap(err)
|
return nil, tracerr.Wrap(err)
|
||||||
}
|
}
|
||||||
// TODO: Get (configCircuits []ConfigCircuit, batchNum common.BatchNum, nLevels uint64) from smart contract
|
// TODO: Get (configCircuits []ConfigCircuit, batchNum common.BatchNum, nLevels uint64) from smart contract
|
||||||
nLevels := uint64(32) //nolint:gomnd
|
nLevels := uint64(32) //nolint:gomnd
|
||||||
batchBuilder, err := batchbuilder.NewBatchBuilder(coordCfg.BatchBuilder.Path, stateDB, nil, 0, nLevels)
|
batchBuilder, err := batchbuilder.NewBatchBuilder(cfg.Coordinator.BatchBuilder.Path, stateDB, nil, 0, nLevels)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, tracerr.Wrap(err)
|
return nil, tracerr.Wrap(err)
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, tracerr.Wrap(err)
|
return nil, tracerr.Wrap(err)
|
||||||
}
|
}
|
||||||
serverProofs := make([]prover.Client, len(coordCfg.ServerProofs))
|
serverProofs := make([]prover.Client, len(cfg.Coordinator.ServerProofs))
|
||||||
for i, serverProofCfg := range coordCfg.ServerProofs {
|
for i, serverProofCfg := range cfg.Coordinator.ServerProofs {
|
||||||
serverProofs[i] = prover.NewProofServerClient(serverProofCfg.URL,
|
serverProofs[i] = prover.NewProofServerClient(serverProofCfg.URL,
|
||||||
coordCfg.ProofServerPollInterval.Duration)
|
cfg.Coordinator.ProofServerPollInterval.Duration)
|
||||||
}
|
}
|
||||||
|
|
||||||
coord, err = coordinator.NewCoordinator(
|
coord, err = coordinator.NewCoordinator(
|
||||||
coordinator.Config{
|
coordinator.Config{
|
||||||
ForgerAddress: coordCfg.ForgerAddress,
|
ForgerAddress: cfg.Coordinator.ForgerAddress,
|
||||||
ConfirmBlocks: coordCfg.ConfirmBlocks,
|
ConfirmBlocks: cfg.Coordinator.ConfirmBlocks,
|
||||||
L1BatchTimeoutPerc: coordCfg.L1BatchTimeoutPerc,
|
L1BatchTimeoutPerc: cfg.Coordinator.L1BatchTimeoutPerc,
|
||||||
SyncRetryInterval: coordCfg.SyncRetryInterval.Duration,
|
SyncRetryInterval: cfg.Coordinator.SyncRetryInterval.Duration,
|
||||||
EthClientAttempts: coordCfg.EthClient.Attempts,
|
EthClientAttempts: cfg.Coordinator.EthClient.Attempts,
|
||||||
EthClientAttemptsDelay: coordCfg.EthClient.AttemptsDelay.Duration,
|
EthClientAttemptsDelay: cfg.Coordinator.EthClient.AttemptsDelay.Duration,
|
||||||
TxManagerCheckInterval: coordCfg.EthClient.CheckLoopInterval.Duration,
|
TxManagerCheckInterval: cfg.Coordinator.EthClient.CheckLoopInterval.Duration,
|
||||||
DebugBatchPath: coordCfg.Debug.BatchPath,
|
DebugBatchPath: cfg.Coordinator.Debug.BatchPath,
|
||||||
Purger: coordinator.PurgerCfg{
|
Purger: coordinator.PurgerCfg{
|
||||||
PurgeBatchDelay: coordCfg.L2DB.PurgeBatchDelay,
|
PurgeBatchDelay: cfg.Coordinator.L2DB.PurgeBatchDelay,
|
||||||
InvalidateBatchDelay: coordCfg.L2DB.InvalidateBatchDelay,
|
InvalidateBatchDelay: cfg.Coordinator.L2DB.InvalidateBatchDelay,
|
||||||
PurgeBlockDelay: coordCfg.L2DB.PurgeBlockDelay,
|
PurgeBlockDelay: cfg.Coordinator.L2DB.PurgeBlockDelay,
|
||||||
InvalidateBlockDelay: coordCfg.L2DB.InvalidateBlockDelay,
|
InvalidateBlockDelay: cfg.Coordinator.L2DB.InvalidateBlockDelay,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
historyDB,
|
historyDB,
|
||||||
@@ -211,7 +210,7 @@ func NewNode(mode Mode, cfg *config.Node, coordCfg *config.Coordinator) (*Node,
|
|||||||
server := gin.Default()
|
server := gin.Default()
|
||||||
coord := false
|
coord := false
|
||||||
if mode == ModeCoordinator {
|
if mode == ModeCoordinator {
|
||||||
coord = coordCfg.API.Coordinator
|
coord = cfg.Coordinator.API.Coordinator
|
||||||
}
|
}
|
||||||
var err error
|
var err error
|
||||||
nodeAPI, err = NewNodeAPI(
|
nodeAPI, err = NewNodeAPI(
|
||||||
@@ -243,7 +242,6 @@ func NewNode(mode Mode, cfg *config.Node, coordCfg *config.Coordinator) (*Node,
|
|||||||
nodeAPI: nodeAPI,
|
nodeAPI: nodeAPI,
|
||||||
debugAPI: debugAPI,
|
debugAPI: debugAPI,
|
||||||
coord: coord,
|
coord: coord,
|
||||||
coordCfg: coordCfg,
|
|
||||||
sync: sync,
|
sync: sync,
|
||||||
cfg: cfg,
|
cfg: cfg,
|
||||||
mode: mode,
|
mode: mode,
|
||||||
|
|||||||
Reference in New Issue
Block a user