utxo

package
v0.0.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 30, 2018 License: BSD-2-Clause Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close added in v0.0.3

func Close()

Close FIXME: this is only for test. We must do it in a graceful way

func DisplayCoinMap

func DisplayCoinMap(cm *CoinsMap)

func InitUtxoLruTip

func InitUtxoLruTip(uc *UtxoConfig)

Types

type CacheView

type CacheView interface {
	GetCoin(outpoint *outpoint.OutPoint) *Coin
	HaveCoin(point *outpoint.OutPoint) bool
	GetBestBlock() (util.Hash, error)
	UpdateCoins(tempCacheCoins *CoinsMap, hash *util.Hash) error
	DynamicMemoryUsage() int64
	GetCacheSize() int
	RemoveCoins(outpoint *outpoint.OutPoint)
	Flush() bool
}

func GetUtxoCacheInstance

func GetUtxoCacheInstance() CacheView

type Coin

type Coin struct {
	// contains filtered or unexported fields
}

func NewEmptyCoin

func NewEmptyCoin() *Coin

func NewFreshCoin added in v0.0.3

func NewFreshCoin(out *txout.TxOut, height int32, isCoinBase bool) *Coin

NewFreshCoin creates an confirmed coin

func NewFreshEmptyCoin added in v0.0.3

func NewFreshEmptyCoin() *Coin

func NewMempoolCoin

func NewMempoolCoin(out *txout.TxOut) *Coin

NewMempoolCoin creates an unconfirmed coin for mempool

func (*Coin) Clear

func (coin *Coin) Clear()

func (*Coin) DeepCopy

func (coin *Coin) DeepCopy() *Coin

func (*Coin) DynamicMemoryUsage

func (coin *Coin) DynamicMemoryUsage() int64

func (*Coin) GetAmount

func (coin *Coin) GetAmount() amount.Amount

func (*Coin) GetHeight

func (coin *Coin) GetHeight() int32

func (*Coin) GetScriptPubKey

func (coin *Coin) GetScriptPubKey() *script.Script

func (*Coin) GetTxOut

func (coin *Coin) GetTxOut() txout.TxOut

func (*Coin) IsCoinBase

func (coin *Coin) IsCoinBase() bool

func (*Coin) IsMempoolCoin

func (coin *Coin) IsMempoolCoin() bool

func (*Coin) IsSpendable

func (coin *Coin) IsSpendable() bool

func (*Coin) IsSpent

func (coin *Coin) IsSpent() bool

func (*Coin) Serialize

func (coin *Coin) Serialize(w io.Writer) error

func (*Coin) Unserialize

func (coin *Coin) Unserialize(r io.Reader) error

type CoinKey

type CoinKey struct {
	// contains filtered or unexported fields
}

func NewCoinKey

func NewCoinKey(outPoint *outpoint.OutPoint) *CoinKey

func (*CoinKey) GetSerKey

func (coinKey *CoinKey) GetSerKey() []byte

func (*CoinKey) Serialize

func (coinKey *CoinKey) Serialize(writer io.Writer) error

func (*CoinKey) Unserialize

func (coinKey *CoinKey) Unserialize(reader io.Reader) error

type CoinsDB

type CoinsDB struct {
	// contains filtered or unexported fields
}

func (*CoinsDB) BatchWrite

func (coinsViewDB *CoinsDB) BatchWrite(cm map[outpoint.OutPoint]*Coin, hashBlock util.Hash) error

func (*CoinsDB) EstimateSize

func (coinsViewDB *CoinsDB) EstimateSize() uint64

func (*CoinsDB) GetBestBlock

func (coinsViewDB *CoinsDB) GetBestBlock() (*util.Hash, error)

func (*CoinsDB) GetCoin

func (coinsViewDB *CoinsDB) GetCoin(outpoint *outpoint.OutPoint) (*Coin, error)

func (*CoinsDB) GetDBW

func (coinsViewDB *CoinsDB) GetDBW() *db.DBWrapper

func (*CoinsDB) HaveCoin

func (coinsViewDB *CoinsDB) HaveCoin(outpoint *outpoint.OutPoint) bool

type CoinsLruCache

type CoinsLruCache struct {
	// contains filtered or unexported fields
}

func (*CoinsLruCache) DynamicMemoryUsage

func (coinsCache *CoinsLruCache) DynamicMemoryUsage() int64

func (*CoinsLruCache) Flush

func (coinsCache *CoinsLruCache) Flush() bool

func (*CoinsLruCache) GetBestBlock

func (coinsCache *CoinsLruCache) GetBestBlock() (util.Hash, error)

func (*CoinsLruCache) GetCacheSize

func (coinsCache *CoinsLruCache) GetCacheSize() int

func (*CoinsLruCache) GetCoin

func (coinsCache *CoinsLruCache) GetCoin(outpoint *outpoint.OutPoint) *Coin

func (*CoinsLruCache) GetCoinsDB

func (coinsCache *CoinsLruCache) GetCoinsDB() CoinsDB

func (*CoinsLruCache) HaveCoin

func (coinsCache *CoinsLruCache) HaveCoin(point *outpoint.OutPoint) bool

func (*CoinsLruCache) RemoveCoins added in v0.0.3

func (coinsCache *CoinsLruCache) RemoveCoins(point *outpoint.OutPoint)

func (*CoinsLruCache) UpdateCoins

func (coinsCache *CoinsLruCache) UpdateCoins(cm *CoinsMap, hash *util.Hash) error

type CoinsMap

type CoinsMap struct {
	// contains filtered or unexported fields
}

func NewEmptyCoinsMap

func NewEmptyCoinsMap() *CoinsMap

func (*CoinsMap) AccessCoin

func (cm *CoinsMap) AccessCoin(outpoint *outpoint.OutPoint) *Coin

func (*CoinsMap) AddCoin

func (cm *CoinsMap) AddCoin(point *outpoint.OutPoint, coin *Coin, possibleOverwrite bool)

func (*CoinsMap) DeepCopy added in v0.0.3

func (cm *CoinsMap) DeepCopy() *CoinsMap

func (*CoinsMap) FetchCoin

func (cm *CoinsMap) FetchCoin(out *outpoint.OutPoint) *Coin

FetchCoin different from GetCoin, if not get coin, FetchCoin will get coin from global cache

func (*CoinsMap) Flush

func (cm *CoinsMap) Flush(hashBlock util.Hash) bool

func (*CoinsMap) GetCoin

func (cm *CoinsMap) GetCoin(outpoint *outpoint.OutPoint) *Coin

func (*CoinsMap) GetMap

func (cm *CoinsMap) GetMap() map[outpoint.OutPoint]*Coin

func (*CoinsMap) GetValueIn added in v0.0.3

func (cm *CoinsMap) GetValueIn(txn *tx.Tx) amount.Amount

func (*CoinsMap) SpendCoin

func (cm *CoinsMap) SpendCoin(point *outpoint.OutPoint) *Coin

SpendCoin spend a specified coin

func (*CoinsMap) SpendGlobalCoin

func (cm *CoinsMap) SpendGlobalCoin(out *outpoint.OutPoint) *Coin

SpendGlobalCoin different from GetCoin, if not get coin, FetchCoin will get coin from global cache

func (*CoinsMap) UnCache

func (cm *CoinsMap) UnCache(point *outpoint.OutPoint)

type UtxoConfig

type UtxoConfig struct {
	Do *db.DBOption
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL