github.com/MetalBlockchain/metalgo@v1.11.9/vms/platformvm/txs/subnet_validator.go (about) 1 // Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. 2 // See the file LICENSE for licensing terms. 3 4 package txs 5 6 import ( 7 "github.com/MetalBlockchain/metalgo/ids" 8 "github.com/MetalBlockchain/metalgo/utils/constants" 9 ) 10 11 // SubnetValidator validates a subnet on the Avalanche network. 12 type SubnetValidator struct { 13 Validator `serialize:"true"` 14 15 // ID of the subnet this validator is validating 16 Subnet ids.ID `serialize:"true" json:"subnetID"` 17 } 18 19 // SubnetID is the ID of the subnet this validator is validating 20 func (v *SubnetValidator) SubnetID() ids.ID { 21 return v.Subnet 22 } 23 24 // Verify this validator is valid 25 func (v *SubnetValidator) Verify() error { 26 switch v.Subnet { 27 case constants.PrimaryNetworkID: 28 return errBadSubnetID 29 default: 30 return v.Validator.Verify() 31 } 32 }