Documentation ¶
Overview ¶
Copyright (C) 2017, Zipper Team. All rights reserved.
This file is part of zipper ¶
The zipper is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
The zipper is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
Index ¶
- type Hash
- type UtxoEntry
- func (entry *UtxoEntry) AddressByIndex(outputIndex int32) []byte
- func (entry *UtxoEntry) AmountByIndex(outputIndex int32) int64
- func (entry *UtxoEntry) AssetByIndex(outputIndex int32) int32
- func (entry *UtxoEntry) BlockHeight() int32
- func (entry *UtxoEntry) IsFullySpent() bool
- func (entry *UtxoEntry) IsOutputSpent(outputIndex int32) bool
- func (entry *UtxoEntry) SpendOutput(outputIndex int32)
- func (entry *UtxoEntry) UnspendOutput(outputIndex int32)
- func (entry *UtxoEntry) Version() int32
- type UtxoViewpoint
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type UtxoEntry ¶
type UtxoEntry struct {
// contains filtered or unexported fields
}
UtxoEntry contains contextual information about an unspent transaction such as which block it was found in, and the spent status of its outputs.
func (*UtxoEntry) AddressByIndex ¶
AddressByIndex returns the public key script for the provided output index.
Returns nil if the output index references an output that does not exist either due to it being invalid or because the output is not part of the view due to previously being spent/pruned.
func (*UtxoEntry) AmountByIndex ¶
AmountByIndex returns the amount of the provided output index.
Returns 0 if the output index references an output that does not exist either due to it being invalid or because the output is not part of the view due to previously being spent/pruned.
func (*UtxoEntry) AssetByIndex ¶
AssetByIndex returns the amount of the provided output index.
Returns 0 if the output index references an output that does not exist either due to it being invalid or because the output is not part of the view due to previously being spent/pruned.
func (*UtxoEntry) BlockHeight ¶
BlockHeight returns the height of the block containing the transaction the utxo entry represents.
func (*UtxoEntry) IsFullySpent ¶
IsFullySpent returns whether or not the transaction the utxo entry represents is fully spent.
func (*UtxoEntry) IsOutputSpent ¶
IsOutputSpent returns whether or not the provided output index has been spent based upon the current state of the unspent transaction output view the entry was obtained from.
Returns true if the output index references an output that does not exist either due to it being invalid or because the output is not part of the view due to previously being spent/pruned.
func (*UtxoEntry) SpendOutput ¶
SpendOutput marks the output at the provided index as spent. Specifying an output index that does not exist will not have any effect.
func (*UtxoEntry) UnspendOutput ¶
UnspendOutput marks the output at the provided index as unspent. Specifying an output index that does not exist will not have any effect.
type UtxoViewpoint ¶
type UtxoViewpoint struct {
// contains filtered or unexported fields
}
UtxoViewpoint represents a view into the set of unspent transaction outputs from a specific point of view in the chain. For example, it could be for the end of the main chain, some point in the history of the main chain, or down a side chain.
The unspent outputs are needed by other transactions for things such as script validation and double spend prevention.
func NewUtxoViewpoint ¶
func NewUtxoViewpoint() *UtxoViewpoint
NewUtxoViewpoint returns a new empty unspent transaction output view.
func (*UtxoViewpoint) AddTxOuts ¶
func (view *UtxoViewpoint) AddTxOuts(tx *proto.Transaction, blockHeight int32)
AddTxOuts adds all outputs in the passed transaction which are not provably unspendable to the view. When the view already has entries for any of the outputs, they are simply marked unspent. All fields will be updated for existing entries since it's possible it has changed during a reorg.
func (*UtxoViewpoint) Entries ¶
func (view *UtxoViewpoint) Entries() map[Hash]*UtxoEntry
Entries returns the underlying map that stores of all the utxo entries.
func (*UtxoViewpoint) LookupEntry ¶
func (view *UtxoViewpoint) LookupEntry(txHash *Hash) *UtxoEntry
LookupEntry returns information about a given transaction according to the current state of the view. It will return nil if the passed transaction hash does not exist in the view or is otherwise not available such as when it has been disconnected during a reorg.