github.com/MetalBlockchain/metalgo@v1.11.9/snow/consensus/avalanche/test_vertex.go (about)

     1  // Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved.
     2  // See the file LICENSE for licensing terms.
     3  
     4  package avalanche
     5  
     6  import (
     7  	"context"
     8  
     9  	"github.com/MetalBlockchain/metalgo/snow/choices"
    10  	"github.com/MetalBlockchain/metalgo/snow/consensus/snowstorm"
    11  )
    12  
    13  var _ Vertex = (*TestVertex)(nil)
    14  
    15  // TestVertex is a useful test vertex
    16  type TestVertex struct {
    17  	choices.TestDecidable
    18  
    19  	ParentsV    []Vertex
    20  	ParentsErrV error
    21  	HeightV     uint64
    22  	HeightErrV  error
    23  	TxsV        []snowstorm.Tx
    24  	TxsErrV     error
    25  	BytesV      []byte
    26  }
    27  
    28  func (v *TestVertex) Parents() ([]Vertex, error) {
    29  	return v.ParentsV, v.ParentsErrV
    30  }
    31  
    32  func (v *TestVertex) Height() (uint64, error) {
    33  	return v.HeightV, v.HeightErrV
    34  }
    35  
    36  func (v *TestVertex) Txs(context.Context) ([]snowstorm.Tx, error) {
    37  	return v.TxsV, v.TxsErrV
    38  }
    39  
    40  func (v *TestVertex) Bytes() []byte {
    41  	return v.BytesV
    42  }