@@ -302,11 +302,11 @@ const (
302
302
)
303
303
304
304
type 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"`
310
310
}
311
311
312
312
func (p * PoolRelay ) UnmarshalCBOR (data []byte ) error {
@@ -391,6 +391,7 @@ type PoolRegistrationCertificate struct {
391
391
}
392
392
393
393
func (p * PoolRegistrationCertificate ) UnmarshalJSON (data []byte ) error {
394
+ //nolint:musttag
394
395
type tempPool struct {
395
396
Operator string `json:"operator"`
396
397
VrfKeyHash string `json:"vrfKeyHash"`
@@ -399,8 +400,15 @@ func (p *PoolRegistrationCertificate) UnmarshalJSON(data []byte) error {
399
400
Margin json.RawMessage `json:"margin"`
400
401
RewardAccount json.RawMessage `json:"rewardAccount"`
401
402
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"`
404
412
}
405
413
406
414
var tmp tempPool
@@ -410,7 +418,16 @@ func (p *PoolRegistrationCertificate) UnmarshalJSON(data []byte) error {
410
418
411
419
p .Pledge = tmp .Pledge
412
420
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
+ }
414
431
p .PoolMetadata = tmp .PoolMetadata
415
432
416
433
// Handle margin field
0 commit comments