Make chainconfig wrapper more robust against differences between types

This commit is contained in:
Austin Roberts 2021-10-18 15:01:04 -05:00
parent 149b5220ad
commit 625d2c0e98

View File

@ -606,10 +606,14 @@ 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)
if v.Type() == lv.Type() && lv.CanSet() { log.Info("Checking value for", "field", field.Name)
lv.Set(v) if lv.Kind() != reflect.Invalid {
} else { // If core.ChainConfig doesn't have this field, skip it.
convertAndSet(lv, v) if v.Type() == lv.Type() && lv.CanSet() {
lv.Set(v)
} else {
convertAndSet(lv, v)
}
} }
} }
return b.chainConfig return b.chainConfig