@@ -302,11 +302,11 @@ const (
302302)
303303
304304type PoolRelay struct {
305- Type int
306- Port * uint32
307- Ipv4 * net.IP
308- Ipv6 * net.IP
309- Hostname * string
305+ Type int `json:"type"`
306+ Port * uint32 `json:"port,omitempty"`
307+ Ipv4 * net.IP `json:"ipv4,omitempty"`
308+ Ipv6 * net.IP `json:"ipv6,omitempty"`
309+ Hostname * string `json:"hostname,omitempty"`
310310}
311311
312312func (p * PoolRelay ) UnmarshalCBOR (data []byte ) error {
@@ -391,6 +391,7 @@ type PoolRegistrationCertificate struct {
391391}
392392
393393func (p * PoolRegistrationCertificate ) UnmarshalJSON (data []byte ) error {
394+ //nolint:musttag
394395 type tempPool struct {
395396 Operator string `json:"operator"`
396397 VrfKeyHash string `json:"vrfKeyHash"`
@@ -399,8 +400,15 @@ func (p *PoolRegistrationCertificate) UnmarshalJSON(data []byte) error {
399400 Margin json.RawMessage `json:"margin"`
400401 RewardAccount json.RawMessage `json:"rewardAccount"`
401402 PoolOwners []string `json:"poolOwners"`
402- Relays []PoolRelay `json:"relays"`
403- PoolMetadata * PoolMetadata `json:"poolMetadata,omitempty"`
403+ Relays []struct {
404+ Type int `json:"type"`
405+ Port * uint32 `json:"port,omitempty"`
406+ Ipv4 * net.IP `json:"ipv4,omitempty"`
407+ Ipv6 * net.IP `json:"ipv6,omitempty"`
408+ Hostname * string `json:"hostname,omitempty"`
409+ } `json:"relays"`
410+
411+ PoolMetadata * PoolMetadata `json:"poolMetadata,omitempty"`
404412 }
405413
406414 var tmp tempPool
@@ -410,7 +418,16 @@ func (p *PoolRegistrationCertificate) UnmarshalJSON(data []byte) error {
410418
411419 p .Pledge = tmp .Pledge
412420 p .Cost = tmp .Cost
413- p .Relays = tmp .Relays
421+ p .Relays = make ([]PoolRelay , len (tmp .Relays ))
422+ for i , relay := range tmp .Relays {
423+ p .Relays [i ] = PoolRelay {
424+ Type : relay .Type ,
425+ Port : relay .Port ,
426+ Ipv4 : relay .Ipv4 ,
427+ Ipv6 : relay .Ipv6 ,
428+ Hostname : relay .Hostname ,
429+ }
430+ }
414431 p .PoolMetadata = tmp .PoolMetadata
415432
416433 // Handle margin field
0 commit comments