Skip to content

Commit f63e1f5

Browse files
authored
[ioctl] config set nsv2height (iotexproject#2179)
1 parent 53434e0 commit f63e1f5

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

ioctl/cmd/node/nodedelegate.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ func delegates() error {
149149
if err != nil {
150150
return output.NewError(0, "failed to get probation list", err)
151151
}
152-
if epochData.Height >= config.ReadConfig.FairBankHeight {
152+
if epochData.Height >= config.ReadConfig.Nsv2height {
153153
return delegatesV2(probationList, response, &message)
154154
}
155155
for rank, bp := range response.BlockProducersInfo {

ioctl/config/config.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ type Config struct {
6464
DefaultAccount Context `json:"defaultAccount" yaml:"defaultAccount"`
6565
Explorer string `json:"explorer" yaml:"explorer"`
6666
Language string `json:"language" yaml:"language"`
67-
FairBankHeight uint64 `json:"fairbankHeight" yaml:"fairbankHeight"`
67+
Nsv2height uint64 `json:"nsv2height" yaml:"nsv2height"`
6868
}
6969

7070
var (
@@ -105,8 +105,8 @@ func init() {
105105
ReadConfig.Language = supportedLanguage[0]
106106
completeness = false
107107
}
108-
if ReadConfig.FairBankHeight == 0 {
109-
ReadConfig.FairBankHeight = config.Default.Genesis.FairbankBlockHeight
108+
if ReadConfig.Nsv2height == 0 {
109+
ReadConfig.Nsv2height = config.Default.Genesis.FairbankBlockHeight
110110
}
111111
if !completeness {
112112
err := writeConfig()

ioctl/config/configsetget.go

+11-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ const (
3131

3232
var (
3333
supportedLanguage = []string{"English", "中文"}
34-
validArgs = []string{"endpoint", "wallet", "explorer", "defaultacc", "language"}
35-
validGetArgs = []string{"endpoint", "wallet", "explorer", "defaultacc", "language", "all"}
34+
validArgs = []string{"endpoint", "wallet", "explorer", "defaultacc", "language", "nsv2height"}
35+
validGetArgs = []string{"endpoint", "wallet", "explorer", "defaultacc", "language", "nsv2height", "all"}
3636
validExpl = []string{"iotexscan", "iotxplorer"}
3737
endpointCompile = regexp.MustCompile("^" + endpointPattern + "$")
3838
)
@@ -149,6 +149,9 @@ func Get(arg string) error {
149149
case "language":
150150
output.PrintResult(ReadConfig.Language)
151151
return nil
152+
case "nsv2height":
153+
fmt.Println(ReadConfig.Nsv2height)
154+
return nil
152155
case "all":
153156
fmt.Println(ReadConfig.String())
154157
return nil
@@ -267,6 +270,12 @@ func set(args []string) error {
267270
args[1], supportedLanguage), nil)
268271
}
269272
ReadConfig.Language = supportedLanguage[language]
273+
case "nsv2height":
274+
height, err := strconv.ParseUint(args[1], 10, 64)
275+
if err != nil {
276+
return output.NewError(output.ValidationError, "invalid height", nil)
277+
}
278+
ReadConfig.Nsv2height = height
270279
}
271280
err := writeConfig()
272281
if err != nil {

0 commit comments

Comments
 (0)