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