github.com/MetalBlockchain/metalgo@v1.11.9/api/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 "github.com/MetalBlockchain/metalgo/codec" 8 "github.com/MetalBlockchain/metalgo/codec/linearcodec" 9 "github.com/MetalBlockchain/metalgo/utils/units" 10 ) 11 12 const ( 13 CodecVersion = 0 14 15 maxPackerSize = 1 * units.GiB // max size, in bytes, of something being marshalled by Marshal() 16 ) 17 18 var Codec codec.Manager 19 20 func init() { 21 lc := linearcodec.NewDefault() 22 Codec = codec.NewManager(maxPackerSize) 23 if err := Codec.RegisterCodec(CodecVersion, lc); err != nil { 24 panic(err) 25 } 26 }