Skip to content

Commit fd12e76

Browse files
authored
Merge pull request #182 from meshplus/fix/bxh-addrs-override
fix(repo): remove default bxh addrs config
2 parents 16a672a + 4421794 commit fd12e76

File tree

4 files changed

+10
-12
lines changed

4 files changed

+10
-12
lines changed

cmd/pier/appchain_bxh.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ func loadClient(keyPath string, grpcAddrs []string, ctx *cli.Context) (rpcx.Clie
250250
}
251251
nodesInfo = append(nodesInfo, nodeInfo)
252252
}
253-
opts = append(opts, rpcx.WithNodesInfo(nodesInfo...))
253+
opts = append(opts, rpcx.WithNodesInfo(nodesInfo...), rpcx.WithTimeoutLimit(config.Mode.Relay.TimeoutLimit))
254254
return rpcx.New(opts...)
255255
}
256256

config/pier.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ report_caller = false
2626
type = "relay" # relay, direct or union
2727
[mode.relay]
2828
addrs = ["localhost:60011", "localhost:60012", "localhost:60013", "localhost:60014"]
29+
timeout_limit = "1s"
2930
quorum = 2
3031
validators = [
3132
"0x000f1a7a08ccc48e5d30f80850cf1cf283aa3abd",

internal/app/pier.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ func NewPier(repoRoot string, config *repo.Config) (*Pier, error) {
145145
}
146146
nodesInfo = append(nodesInfo, nodeInfo)
147147
}
148-
opts = append(opts, rpcx.WithNodesInfo(nodesInfo...))
148+
opts = append(opts, rpcx.WithNodesInfo(nodesInfo...), rpcx.WithTimeoutLimit(config.Mode.Relay.TimeoutLimit))
149149
client, err := rpcx.New(opts...)
150150
if err != nil {
151151
return nil, fmt.Errorf("create bitxhub client: %w", err)
@@ -303,7 +303,7 @@ func NewUnionPier(repoRoot string, config *repo.Config) (*Pier, error) {
303303
}
304304
nodesInfo = append(nodesInfo, nodeInfo)
305305
}
306-
opts = append(opts, rpcx.WithNodesInfo(nodesInfo...))
306+
opts = append(opts, rpcx.WithNodesInfo(nodesInfo...), rpcx.WithTimeoutLimit(config.Mode.Relay.TimeoutLimit))
307307
client, err := rpcx.New(opts...)
308308
if err != nil {
309309
return nil, fmt.Errorf("create bitxhub client: %w", err)

internal/repo/config.go

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"fmt"
55
"path/filepath"
66
"strings"
7+
"time"
78

89
"github.com/meshplus/bitxhub-kit/fileutil"
910
"github.com/meshplus/bitxhub-kit/types"
@@ -54,9 +55,10 @@ type Mode struct {
5455

5556
// Relay are configs about bitxhub
5657
type Relay struct {
57-
Addrs []string `toml:"addrs" json:"addrs"`
58-
Quorum uint64 `toml:"quorum" json:"quorum"`
59-
Validators []string `toml:"validators" json:"validators"`
58+
Addrs []string `toml:"addrs" json:"addrs"`
59+
TimeoutLimit time.Duration `mapstructure:"timeout_limit" json:"timeout_limit"`
60+
Quorum uint64 `toml:"quorum" json:"quorum"`
61+
Validators []string `toml:"validators" json:"validators"`
6062
}
6163

6264
type Direct struct {
@@ -118,12 +120,7 @@ func DefaultConfig() *Config {
118120
Mode: Mode{
119121
Type: "relay",
120122
Relay: Relay{
121-
Addrs: []string{
122-
"localhost:60011",
123-
"localhost:60012",
124-
"localhost:60013",
125-
"localhost:60014",
126-
},
123+
Addrs: []string{"localhost:60011"},
127124
Quorum: 2,
128125
Validators: []string{
129126
"0x000f1a7a08ccc48e5d30f80850cf1cf283aa3abd",

0 commit comments

Comments
 (0)