Ori Newman 2adb4f5d0f
Fix UTXO index (#1548)
* Add VirtualUTXODiff and VirtualParents to block insertion result

* Add GetVirtualUTXOs

* Add OnPruningPointUTXOSetOverrideHandler

* Add recovery to UTXO index

* Add UTXO set override notification

* Fix compilation error

* Fix iterators in UTXO index and fix TestUTXOIndex

* Change Dialing to DEBUG

* Change LogBlock location

* Rename StopNotify to StopNotifying

* Add sanity check

* Add comment

* Remove receiver from serialization functions

Co-authored-by: Elichai Turkel <elichai.turkel@gmail.com>
2021-02-23 16:51:51 +02:00

32 lines
910 B
Go

package externalapi
// UTXOCollection represents a collection of UTXO entries, indexed by their outpoint
type UTXOCollection interface {
Iterator() ReadOnlyUTXOSetIterator
Get(outpoint *DomainOutpoint) (UTXOEntry, bool)
Contains(outpoint *DomainOutpoint) bool
Len() int
}
// UTXODiff represents the diff between two UTXO sets
type UTXODiff interface {
ToAdd() UTXOCollection
ToRemove() UTXOCollection
WithDiff(other UTXODiff) (UTXODiff, error)
DiffFrom(other UTXODiff) (UTXODiff, error)
CloneMutable() MutableUTXODiff
}
// MutableUTXODiff represents a UTXO-Diff that can be mutated
type MutableUTXODiff interface {
ToImmutable() UTXODiff
WithDiff(other UTXODiff) (UTXODiff, error)
DiffFrom(other UTXODiff) (UTXODiff, error)
ToAdd() UTXOCollection
ToRemove() UTXOCollection
WithDiffInPlace(other UTXODiff) error
AddTransaction(transaction *DomainTransaction, blockBlueScore uint64) error
}