Fix problem in setPRep for handling on empty values
@@ -518,15 +518,8 @@ func (s *chainScore) Ex_getPRepManager() (map[string]interface{}, error) {
return jso, nil
}
-func paramStrToPtr(value string) *string {
- if len(value) == 0 {
- return nil
- }
- return &value
-}
-
-func (s *chainScore) Ex_setPRep(name string, email string, website string, country string,
- city string, details string, p2pEndpoint string, node module.Address) error {
+func (s *chainScore) Ex_setPRep(name *string, email *string, website *string, country *string,
+ city *string, details *string, p2pEndpoint *string, node module.Address) error {
var err error
var es *iiss.ExtensionStateImpl
@@ -544,13 +537,13 @@ func (s *chainScore) Ex_setPRep(name string, email string, website string, count
}
info := &icstate.PRepInfo{
- City: paramStrToPtr(city),
- Country: paramStrToPtr(country),
- Details: paramStrToPtr(details),
- Email: paramStrToPtr(email),
- Name: paramStrToPtr(name),
- P2PEndpoint: paramStrToPtr(p2pEndpoint),
- WebSite: paramStrToPtr(website),
+ City: city,
+ Country: country,
+ Details: details,
+ Email: email,
+ Name: name,
+ P2PEndpoint: p2pEndpoint,
+ WebSite: website,
Node: node,
}
