OSDN Git Service

writer close
[bytom/vapor.git] / database / storage / utxo_entry.go
1 package storage
2
3 const (
4         NormalUTXOType uint32 = iota
5         CoinbaseUTXOType
6         CrosschainUTXOType
7         VoteUTXOType
8 )
9
10 // NewUtxoEntry will create a new utxo entry
11 func NewUtxoEntry(utxoType uint32, blockHeight uint64, spent bool) *UtxoEntry {
12         return &UtxoEntry{
13                 Type:        utxoType,
14                 BlockHeight: blockHeight,
15                 Spent:       spent,
16         }
17 }
18
19 // SpendOutput marks the output at the provided index as spent
20 func (entry *UtxoEntry) SpendOutput() {
21         entry.Spent = true
22 }
23
24 // UnspendOutput marks the output at the provided index as unspent
25 func (entry *UtxoEntry) UnspendOutput() {
26         entry.Spent = false
27 }