[#1713] ir: Add Neo RPC switch interval to the config
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
d240e2dc87
commit
0631b38da1
4 changed files with 7 additions and 0 deletions
|
@ -50,9 +50,11 @@ func defaultConfiguration(cfg *viper.Viper) {
|
||||||
cfg.SetDefault("morph.endpoint.client", []string{})
|
cfg.SetDefault("morph.endpoint.client", []string{})
|
||||||
cfg.SetDefault("morph.dial_timeout", 15*time.Second)
|
cfg.SetDefault("morph.dial_timeout", 15*time.Second)
|
||||||
cfg.SetDefault("morph.validators", []string{})
|
cfg.SetDefault("morph.validators", []string{})
|
||||||
|
cfg.SetDefault("morph.switch_interval", 2*time.Minute)
|
||||||
|
|
||||||
cfg.SetDefault("mainnet.endpoint.client", []string{})
|
cfg.SetDefault("mainnet.endpoint.client", []string{})
|
||||||
cfg.SetDefault("mainnet.dial_timeout", 15*time.Second)
|
cfg.SetDefault("mainnet.dial_timeout", 15*time.Second)
|
||||||
|
cfg.SetDefault("mainnet.switch_interval", 2*time.Minute)
|
||||||
|
|
||||||
cfg.SetDefault("wallet.path", "") // inner ring node NEP-6 wallet
|
cfg.SetDefault("wallet.path", "") // inner ring node NEP-6 wallet
|
||||||
cfg.SetDefault("wallet.address", "") // account address
|
cfg.SetDefault("wallet.address", "") // account address
|
||||||
|
|
|
@ -10,10 +10,12 @@ NEOFS_IR_MORPH_DIAL_TIMEOUT=5s
|
||||||
NEOFS_IR_MORPH_ENDPOINT_CLIENT_0_ADDRESS="wss://sidechain1.fs.neo.org:30333/ws"
|
NEOFS_IR_MORPH_ENDPOINT_CLIENT_0_ADDRESS="wss://sidechain1.fs.neo.org:30333/ws"
|
||||||
NEOFS_IR_MORPH_ENDPOINT_CLIENT_1_ADDRESS="wss://sidechain2.fs.neo.org:30333/ws"
|
NEOFS_IR_MORPH_ENDPOINT_CLIENT_1_ADDRESS="wss://sidechain2.fs.neo.org:30333/ws"
|
||||||
NEOFS_IR_MORPH_VALIDATORS="0283120f4c8c1fc1d792af5063d2def9da5fddc90bc1384de7fcfdda33c3860170"
|
NEOFS_IR_MORPH_VALIDATORS="0283120f4c8c1fc1d792af5063d2def9da5fddc90bc1384de7fcfdda33c3860170"
|
||||||
|
NEOFS_IR_MORPH_SWITCH_INTERVAL=2m
|
||||||
|
|
||||||
NEOFS_IR_MAINNET_DIAL_TIMEOUT=5s
|
NEOFS_IR_MAINNET_DIAL_TIMEOUT=5s
|
||||||
NEOFS_IR_MAINNET_ENDPOINT_CLIENT_0_ADDRESS="wss://mainchain1.fs.neo.org:30333/ws"
|
NEOFS_IR_MAINNET_ENDPOINT_CLIENT_0_ADDRESS="wss://mainchain1.fs.neo.org:30333/ws"
|
||||||
NEOFS_IR_MAINNET_ENDPOINT_CLIENT_1_ADDRESS="wss://mainchain2.fs.neo.org:30333/ws"
|
NEOFS_IR_MAINNET_ENDPOINT_CLIENT_1_ADDRESS="wss://mainchain2.fs.neo.org:30333/ws"
|
||||||
|
NEOFS_IR_MAINNET_SWITCH_INTERVAL=2m
|
||||||
|
|
||||||
NEOFS_IR_CONTROL_AUTHORIZED_KEYS="035839e45d472a3b7769a2a1bd7d54c4ccd4943c3b40f547870e83a8fcbfb3ce11 028f42cfcb74499d7b15b35d9bff260a1c8d27de4f446a627406a382d8961486d6"
|
NEOFS_IR_CONTROL_AUTHORIZED_KEYS="035839e45d472a3b7769a2a1bd7d54c4ccd4943c3b40f547870e83a8fcbfb3ce11 028f42cfcb74499d7b15b35d9bff260a1c8d27de4f446a627406a382d8961486d6"
|
||||||
NEOFS_IR_CONTROL_GRPC_ENDPOINT=localhost:8090
|
NEOFS_IR_CONTROL_GRPC_ENDPOINT=localhost:8090
|
||||||
|
|
|
@ -18,9 +18,11 @@ morph:
|
||||||
- address: wss://sidechain2.fs.neo.org:30333/ws
|
- address: wss://sidechain2.fs.neo.org:30333/ws
|
||||||
validators: # List of hex-encoded 33-byte public keys of sidechain validators to vote for at application startup
|
validators: # List of hex-encoded 33-byte public keys of sidechain validators to vote for at application startup
|
||||||
- 0283120f4c8c1fc1d792af5063d2def9da5fddc90bc1384de7fcfdda33c3860170
|
- 0283120f4c8c1fc1d792af5063d2def9da5fddc90bc1384de7fcfdda33c3860170
|
||||||
|
switch_interval: 2m # interval b/w RPC switch attempts if the node is not connected to the highest priority node
|
||||||
|
|
||||||
mainnet:
|
mainnet:
|
||||||
dial_timeout: 5s # Timeout for RPC client connection to mainchain; ignore if mainchain is disabled
|
dial_timeout: 5s # Timeout for RPC client connection to mainchain; ignore if mainchain is disabled
|
||||||
|
switch_interval: 2m # interval b/w RPC switch attempts if the node is not connected to the highest priority node
|
||||||
endpoint:
|
endpoint:
|
||||||
client: # List of websocket RPC endpoints in mainchain; ignore if mainchain is disabled
|
client: # List of websocket RPC endpoints in mainchain; ignore if mainchain is disabled
|
||||||
- address: wss://mainchain1.fs.neo.org:30333/ws
|
- address: wss://mainchain1.fs.neo.org:30333/ws
|
||||||
|
|
|
@ -1007,6 +1007,7 @@ func createClient(ctx context.Context, p *chainParams, errChan chan<- error) (*c
|
||||||
client.WithConnLostCallback(func() {
|
client.WithConnLostCallback(func() {
|
||||||
errChan <- fmt.Errorf("%s chain connection has been lost", p.name)
|
errChan <- fmt.Errorf("%s chain connection has been lost", p.name)
|
||||||
}),
|
}),
|
||||||
|
client.WithSwitchInterval(p.cfg.GetDuration(p.name+".switch_interval")),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue