state

package
v0.0.0-...-0b9d80d Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2016 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package state provides types for encapsulating blockchain state.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OutputTreeItem

func OutputTreeItem(o *Output) (bkey, commitment []byte)

OutputTreeItem returns the key of an output in the state tree, as well as the output commitment (a second []byte) for Inserts into the state tree.

Types

type Output

type Output struct {
	bc.Outpoint
	bc.TxOutput
}

Output represents a spent or unspent output for the validation process.

func NewOutput

func NewOutput(o bc.TxOutput, p bc.Outpoint) *Output

NewOutput creates a new Output.

func Prevout

func Prevout(in *bc.TxInput) *Output

Prevout returns the Output consumed by the provided tx input. It only includes the output data that is embedded within inputs (ex, excludes reference data).

type PriorIssuances

type PriorIssuances map[bc.Hash]uint64

PriorIssuances maps an "issuance hash" to the time (in Unix millis) at which it should expire from the issuance memory.

type Snapshot

type Snapshot struct {
	Tree      *patricia.Tree
	Issuances PriorIssuances
}

Snapshot encompasses a snapshot of entire blockchain state. It consists of a patricia state tree and the issuances memory.

func Copy

func Copy(original *Snapshot) *Snapshot

Copy makes a copy of provided snapshot. Copying a snapshot is an O(n) operation where n is the number of issuance hashes in the snapshot's issuance memory.

func Empty

func Empty() *Snapshot

Empty returns an empty state snapshot.

func (*Snapshot) PruneIssuances

func (s *Snapshot) PruneIssuances(timestampMS uint64)

PruneIssuances modifies a Snapshot, removing all issuance hashes with expiration times earlier than the provided timestamp.

Jump to

Keyboard shortcuts

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