forked from kaspanet/kaspad
/
utxodiff.go
32 lines (27 loc) · 930 Bytes
/
utxodiff.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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)
Reversed() UTXODiff
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, blockDAAScore uint64) error
}