Fix Genesis.json parsing
This commit is contained in:
parent
f491c8d8fb
commit
8d5274639b
|
@ -71,7 +71,7 @@ func loadGenesis(filePath string) (kvz []KeyValue) {
|
|||
if len(kvz_)%2 != 0 {
|
||||
Exit("genesis cannot have an odd number of items. Format = [key1, value1, key2, value2, ...]")
|
||||
}
|
||||
for i := 0; i < len(kvz_)/2; i++ {
|
||||
for i := 0; i < len(kvz_); i += 2 {
|
||||
keyIfc := kvz_[i]
|
||||
valueIfc := kvz_[i+1]
|
||||
var key, value string
|
||||
|
@ -82,7 +82,7 @@ func loadGenesis(filePath string) (kvz []KeyValue) {
|
|||
if value_, ok := valueIfc.(string); ok {
|
||||
value = value_
|
||||
} else {
|
||||
valueBytes, err := json.Marshal(value_)
|
||||
valueBytes, err := json.Marshal(valueIfc)
|
||||
if err != nil {
|
||||
Exit(Fmt("genesis had invalid value %v: %v", value_, err.Error()))
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue