utxoref

package
v0.70.13 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package utxoref provides Key, a comparable, allocation-free identifier for a transaction input or output reference (a producing transaction hash plus output index).

The ledger, ledger/forging, and mempool packages each track UTxO overlays -- inputs consumed and outputs created by in-flight transactions, whether pending in the mempool, applied earlier in the same block, or selected earlier for the block currently being forged -- keyed by this reference. Historically each of those call sites built the key with fmt.Sprintf("%s:%d", ...)/fmt.Sprintf("%x:%d", ...), allocating a formatted, hex-encoded string on every consulted or recorded input and output. Key is a plain value type (a fixed-size hash array and a uint32), so using it as a map key never allocates.

This package has no dependency on ledger, forging, or mempool, and none of those packages depend on each other for it: it exists precisely so all three (and any future caller) can share one comparable key type without introducing a new inter-package coupling.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Key

type Key struct {
	TxId  lcommon.Blake2b256
	Index uint32
}

Key identifies a UTxO -- or, equivalently, the input that spends one -- by its producing transaction hash and output index.

func ForInput

func ForInput(input lcommon.TransactionInput) Key

ForInput returns the Key identifying the UTxO a transaction input spends.

func ForUtxo

func ForUtxo(utxo lcommon.Utxo) Key

ForUtxo returns the Key identifying a produced UTxO.

func (Key) String

func (k Key) String() string

String renders the key in the same "<hex-hash>:<index>" shape the formatted string keys it replaces used. It allocates and exists for logging and error messages only -- never call it on a hot path.

Jump to

Keyboard shortcuts

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