github.com/MetalBlockchain/metalgo@v1.11.9/vms/proposervm/block/option.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  	"github.com/MetalBlockchain/metalgo/ids"
     8  	"github.com/MetalBlockchain/metalgo/utils/hashing"
     9  )
    10  
    11  type option struct {
    12  	PrntID     ids.ID `serialize:"true"`
    13  	InnerBytes []byte `serialize:"true"`
    14  
    15  	id    ids.ID
    16  	bytes []byte
    17  }
    18  
    19  func (b *option) ID() ids.ID {
    20  	return b.id
    21  }
    22  
    23  func (b *option) ParentID() ids.ID {
    24  	return b.PrntID
    25  }
    26  
    27  func (b *option) Block() []byte {
    28  	return b.InnerBytes
    29  }
    30  
    31  func (b *option) Bytes() []byte {
    32  	return b.bytes
    33  }
    34  
    35  func (b *option) initialize(bytes []byte) error {
    36  	b.id = hashing.ComputeHash256Array(bytes)
    37  	b.bytes = bytes
    38  	return nil
    39  }
    40  
    41  func (*option) verify(ids.ID) error {
    42  	return nil
    43  }