github.com/ava-labs/avalanchego@v1.11.11/vms/components/keystore/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 keystore 5 6 import ( 7 "errors" 8 "math" 9 10 "github.com/ava-labs/avalanchego/codec" 11 "github.com/ava-labs/avalanchego/codec/linearcodec" 12 ) 13 14 const CodecVersion = 0 15 16 var ( 17 Codec codec.Manager 18 LegacyCodec codec.Manager 19 ) 20 21 func init() { 22 c := linearcodec.NewDefault() 23 Codec = codec.NewDefaultManager() 24 lc := linearcodec.NewDefault() 25 LegacyCodec = codec.NewManager(math.MaxInt32) 26 27 err := errors.Join( 28 Codec.RegisterCodec(CodecVersion, c), 29 LegacyCodec.RegisterCodec(CodecVersion, lc), 30 ) 31 if err != nil { 32 panic(err) 33 } 34 }