github.com/bytom/bytom@v1.1.2-0.20221014091027-bbcba3df6075/database/storage/utxo_entry.go (about)

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