github.com/MetalBlockchain/metalgo@v1.11.9/vms/proposervm/block/codec.go (about) 1 // Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. 2 // See the file LICENSE for licensing terms. 3 4 package block 5 6 import ( 7 "errors" 8 "math" 9 10 "github.com/MetalBlockchain/metalgo/codec" 11 "github.com/MetalBlockchain/metalgo/codec/linearcodec" 12 ) 13 14 const CodecVersion = 0 15 16 var Codec codec.Manager 17 18 func init() { 19 lc := linearcodec.NewDefault() 20 // The maximum block size is enforced by the p2p message size limit. 21 // See: [constants.DefaultMaxMessageSize] 22 Codec = codec.NewManager(math.MaxInt) 23 24 err := errors.Join( 25 lc.RegisterType(&statelessBlock{}), 26 lc.RegisterType(&option{}), 27 Codec.RegisterCodec(CodecVersion, lc), 28 ) 29 if err != nil { 30 panic(err) 31 } 32 }