mirror of
https://github.com/luxfi/proto.git
synced 2026-10-30 15:21:09 +00:00
proto required luxfi/node and luxfi/node required proto, with no replace directive on either side. The cycle was not load-bearing: most of it was proto reaching into the node for packages proto already owns — p/warp, p/txs, p/signer, p/stakeable, p/security, x/txs — which now name themselves. Two were real. The UTXO components moved here, where the chains that use them already live, and the node is the only other caller, so that dependency now runs one way. And p/config held the node's chain manager to queue a chain the P-Chain had accepted a CreateChainTx for; it calls one method, so it declares one method. A P-Chain that imports the node to describe QueueChainCreation is what made two modules require each other. Dropping the requirement dropped a registration with it: lux.ParseUTXO is a registry filled by an init, which the node used to link in on proto's behalf. The packages that call it now say so themselves. Co-authored-by: Hanzo Dev <[email protected]>
33 lines
724 B
Go
33 lines
724 B
Go
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
|
|
package lux
|
|
|
|
import "github.com/luxfi/ids"
|
|
|
|
// Removes the UTXOs consumed by [ins] from the UTXO set
|
|
func Consume(utxoDB UTXODeleter, ins []*TransferableInput) {
|
|
for _, input := range ins {
|
|
utxoDB.DeleteUTXO(input.InputID())
|
|
}
|
|
}
|
|
|
|
// Adds the UTXOs created by [outs] to the UTXO set.
|
|
// [txID] is the ID of the tx that created [outs].
|
|
func Produce(
|
|
utxoDB UTXOAdder,
|
|
txID ids.ID,
|
|
outs []*TransferableOutput,
|
|
) {
|
|
for index, out := range outs {
|
|
utxoDB.AddUTXO(&UTXO{
|
|
UTXOID: UTXOID{
|
|
TxID: txID,
|
|
OutputIndex: uint32(index),
|
|
},
|
|
Asset: out.Asset,
|
|
Out: out.Output(),
|
|
})
|
|
}
|
|
}
|