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.