github.com/MetalBlockchain/metalgo@v1.11.9/vms/platformvm/block/parse.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 "github.com/MetalBlockchain/metalgo/codec"
     7  
     8  func Parse(c codec.Manager, b []byte) (Block, error) {
     9  	var blk Block
    10  	if _, err := c.Unmarshal(b, &blk); err != nil {
    11  		return nil, err
    12  	}
    13  	return blk, blk.initialize(b)
    14  }