Make chainconfig wrapper more robust against differences between types
This commit is contained in:
parent
149b5220ad
commit
625d2c0e98
@ -606,11 +606,15 @@ func (b *Backend) ChainConfig() *params.ChainConfig {
|
|||||||
field := ntype.Field(i)
|
field := ntype.Field(i)
|
||||||
v := nval.Elem().FieldByName(field.Name)
|
v := nval.Elem().FieldByName(field.Name)
|
||||||
lv := lval.Elem().FieldByName(field.Name)
|
lv := lval.Elem().FieldByName(field.Name)
|
||||||
|
log.Info("Checking value for", "field", field.Name)
|
||||||
|
if lv.Kind() != reflect.Invalid {
|
||||||
|
// If core.ChainConfig doesn't have this field, skip it.
|
||||||
if v.Type() == lv.Type() && lv.CanSet() {
|
if v.Type() == lv.Type() && lv.CanSet() {
|
||||||
lv.Set(v)
|
lv.Set(v)
|
||||||
} else {
|
} else {
|
||||||
convertAndSet(lv, v)
|
convertAndSet(lv, v)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return b.chainConfig
|
return b.chainConfig
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user