github.com/MetalBlockchain/metalgo@v1.11.9/snow/consensus/snowstorm/tx.go (about)

     1  // Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved.
     2  // See the file LICENSE for licensing terms.
     3  
     4  package snowstorm
     5  
     6  import (
     7  	"context"
     8  
     9  	"github.com/MetalBlockchain/metalgo/ids"
    10  	"github.com/MetalBlockchain/metalgo/snow/choices"
    11  	"github.com/MetalBlockchain/metalgo/utils/set"
    12  )
    13  
    14  // Tx consumes state.
    15  type Tx interface {
    16  	choices.Decidable
    17  
    18  	// MissingDependencies returns the set of transactions that must be accepted
    19  	// before this transaction is accepted.
    20  	MissingDependencies() (set.Set[ids.ID], error)
    21  
    22  	// Verify that the state transition this transaction would make if it were
    23  	// accepted is valid. If the state transition is invalid, a non-nil error
    24  	// should be returned.
    25  	//
    26  	// It is guaranteed that when Verify is called, all the dependencies of
    27  	// this transaction have already been successfully verified.
    28  	Verify(context.Context) error
    29  
    30  	// Bytes returns the binary representation of this transaction.
    31  	//
    32  	// This is used for sending transactions to peers. Another node should be
    33  	// able to parse these bytes to the same transaction.
    34  	Bytes() []byte
    35  }