utxoindex

package
v0.10.3 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2021 License: ISC Imports: 9 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertStringToScriptPublicKey

func ConvertStringToScriptPublicKey(string ScriptPublicKeyString) *externalapi.ScriptPublicKey

ConvertStringToScriptPublicKey converts the given string to a scriptPublicKey

Types

type ScriptPublicKeyString

type ScriptPublicKeyString string

ScriptPublicKeyString is a script public key represented as a string We use this type rather than just a byte slice because Go maps don't support slices as keys. See: UTXOChanges

func ConvertScriptPublicKeyToString

func ConvertScriptPublicKeyToString(scriptPublicKey *externalapi.ScriptPublicKey) ScriptPublicKeyString

ConvertScriptPublicKeyToString converts the given scriptPublicKey to a string

type UTXOChanges

type UTXOChanges struct {
	Added   map[ScriptPublicKeyString]UTXOOutpointEntryPairs
	Removed map[ScriptPublicKeyString]UTXOOutpoints
}

UTXOChanges is the set of changes made to the UTXO index after a successful update

type UTXOIndex

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

UTXOIndex maintains an index between transaction scriptPublicKeys and UTXOs

func New

func New(consensus externalapi.Consensus, database database.Database) (*UTXOIndex, error)

New creates a new UTXO index.

NOTE: While this is called no new blocks can be added to the consensus.

func (*UTXOIndex) Reset added in v0.8.10

func (ui *UTXOIndex) Reset() error

Reset deletes the whole UTXO index and resyncs it from consensus.

func (*UTXOIndex) UTXOs

func (ui *UTXOIndex) UTXOs(scriptPublicKey *externalapi.ScriptPublicKey) (UTXOOutpointEntryPairs, error)

UTXOs returns all the UTXOs for the given scriptPublicKey

func (*UTXOIndex) Update

func (ui *UTXOIndex) Update(blockInsertionResult *externalapi.BlockInsertionResult) (*UTXOChanges, error)

Update updates the UTXO index with the given DAG selected parent chain changes

type UTXOOutpointEntryPairs

type UTXOOutpointEntryPairs map[externalapi.DomainOutpoint]externalapi.UTXOEntry

UTXOOutpointEntryPairs is a map between UTXO outpoints to UTXO entries

type UTXOOutpoints

type UTXOOutpoints map[externalapi.DomainOutpoint]interface{}

UTXOOutpoints is a set of UTXO outpoints

Jump to

Keyboard shortcuts

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