Help us shape the future of Go! Take the 2026 Go Developer Survey

utxo

package
v1.30.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 7, 2026 License: BSD-3-Clause Imports: 18 Imported by: 3

Documentation

Overview

Package utxo is a generated GoMock package.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInsufficientFunds         = errors.New("insufficient funds")
	ErrInsufficientUnlockedFunds = errors.New("insufficient unlocked funds")
	ErrInsufficientLockedFunds   = errors.New("insufficient locked funds")
)
View Source
var UTXOAssetID ids.ID

UTXOAssetID is the LUX asset ID. It is set during node initialization from the genesis configuration via the VM context.

Functions

func NewVerifier

func NewVerifier(clk *mockable.Clock, fx fx.Fx) *verifier

NewVerifier creates a new UTXO verifier

Types

type Handler added in v1.1.11

type Handler interface {
	Spender
	Verifier
}

func NewHandler added in v1.1.11

func NewHandler(
	ctx context.Context,
	clk *mockable.Clock,
	fx fx.Fx,
) Handler

type MockVerifier added in v1.1.11

type MockVerifier struct {
	// contains filtered or unexported fields
}

MockVerifier is a mock of Verifier interface.

func NewMockVerifier added in v1.1.11

func NewMockVerifier(ctrl *gomock.Controller) *MockVerifier

NewMockVerifier creates a new mock instance.

func (*MockVerifier) EXPECT added in v1.1.11

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockVerifier) VerifySpend added in v1.1.11

func (m *MockVerifier) VerifySpend(arg0 txs.UnsignedTx, arg1 lux.UTXOGetter, arg2 []*lux.TransferableInput, arg3 []*lux.TransferableOutput, arg4 []verify.Verifiable, arg5 map[ids.ID]uint64) error

VerifySpend mocks base method.

func (*MockVerifier) VerifySpendUTXOs added in v1.1.11

func (m *MockVerifier) VerifySpendUTXOs(arg0 txs.UnsignedTx, arg1 []*lux.UTXO, arg2 []*lux.TransferableInput, arg3 []*lux.TransferableOutput, arg4 []verify.Verifiable, arg5 map[ids.ID]uint64) error

VerifySpendUTXOs mocks base method.

type MockVerifierMockRecorder added in v1.1.11

type MockVerifierMockRecorder struct {
	// contains filtered or unexported fields
}

MockVerifierMockRecorder is the mock recorder for MockVerifier.

func (*MockVerifierMockRecorder) VerifySpend added in v1.1.11

func (mr *MockVerifierMockRecorder) VerifySpend(arg0, arg1, arg2, arg3, arg4, arg5 any) *gomock.Call

VerifySpend indicates an expected call of VerifySpend.

func (*MockVerifierMockRecorder) VerifySpendUTXOs added in v1.1.11

func (mr *MockVerifierMockRecorder) VerifySpendUTXOs(arg0, arg1, arg2, arg3, arg4, arg5 any) *gomock.Call

VerifySpendUTXOs indicates an expected call of VerifySpendUTXOs.

type Spender added in v1.1.11

type Spender interface {
	// Spend the provided amount while deducting the provided fee.
	// Arguments:
	// - [keys] are the owners of the funds
	// - [amount] is the amount of funds that are trying to be staked
	// - [fee] is the amount of LUX that should be burned
	// - [changeAddr] is the address that change, if there is any, is sent to
	// Returns:
	// - [inputs] the inputs that should be consumed to fund the outputs
	// - [returnedOutputs] the outputs that should be immediately returned to
	//                     the UTXO set
	// - [stakedOutputs] the outputs that should be locked for the duration of
	//                   the staking period
	// - [signers] the proof of ownership of the funds being moved
	Spend(
		utxoReader lux.UTXOReader,
		keys []*secp256k1.PrivateKey,
		amount uint64,
		fee uint64,
		changeAddr ids.ShortID,
	) (
		[]*lux.TransferableInput,
		[]*lux.TransferableOutput,
		[]*lux.TransferableOutput,
		[][]*secp256k1.PrivateKey,
		error,
	)

	// Authorize an operation on behalf of the named net with the provided
	// keys.
	Authorize(
		state state.Chain,
		netID ids.ID,
		keys []*secp256k1.PrivateKey,
	) (
		verify.Verifiable,
		[]*secp256k1.PrivateKey,
		error,
	)
}

Spender selects UTXOs and produces inputs/outputs for staking transactions.

type Verifier

type Verifier interface {
	// Verify that [tx] is semantically valid.
	// [ins] and [outs] are the inputs and outputs of [tx].
	// [creds] are the credentials of [tx], which allow [ins] to be spent.
	// [unlockedProduced] is the map of assets that were produced and their
	// amounts.
	// The [ins] must have at least [unlockedProduced] than the [outs].
	//
	// Precondition: [tx] has already been syntactically verified.
	//
	// Note: [unlockedProduced] is modified by this method.
	VerifySpend(
		tx txs.UnsignedTx,
		utxoDB lux.UTXOGetter,
		ins []*lux.TransferableInput,
		outs []*lux.TransferableOutput,
		creds []verify.Verifiable,
		unlockedProduced map[ids.ID]uint64,
	) error

	// Verify that [tx] is semantically valid.
	// [utxos[i]] is the UTXO being consumed by [ins[i]].
	// [ins] and [outs] are the inputs and outputs of [tx].
	// [creds] are the credentials of [tx], which allow [ins] to be spent.
	// [unlockedProduced] is the map of assets that were produced and their
	// amounts.
	// The [ins] must have at least [unlockedProduced] more than the [outs].
	//
	// Precondition: [tx] has already been syntactically verified.
	//
	// Note: [unlockedProduced] is modified by this method.
	VerifySpendUTXOs(
		tx txs.UnsignedTx,
		utxos []*lux.UTXO,
		ins []*lux.TransferableInput,
		outs []*lux.TransferableOutput,
		creds []verify.Verifiable,
		unlockedProduced map[ids.ID]uint64,
	) error
}

Directories

Path Synopsis
Package utxomock is a generated GoMock package.
Package utxomock is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL