transactionpool

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2015 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FileContractConfirmWindow = 10
	TransactionSizeLimit      = 16 * 1024

	PrefixNonSia = "NonSia"
)

Variables

View Source
var (
	ErrDoubleSpend = errors.New("transaction spends an output that was spent by another transaction in the pool")
)
View Source
var (
	ErrDuplicate = errors.New("transaction is a duplicate")
)

Functions

This section is empty.

Types

type TransactionPool

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

The transaction pool keeps an unconfirmed set of transactions along with the contracts and outputs that have been created by unconfirmed transactions. Incoming transactions are allowed to use objects in the unconfirmed consensus set, and in doing so will consume them, preventing other transactions from using them.

Then there are a set of maps indicating which unconfirmed transactions have created or consumed objects in the consensus set. This helps with detecting invalid transactions, and transactions that are in conflict with other unconfirmed transactions.

func New

func New(s *consensus.State, g modules.Gateway) (tp *TransactionPool, err error)

New creates a transaction pool that's ready to receive transactions.

func (*TransactionPool) AcceptTransaction

func (tp *TransactionPool) AcceptTransaction(t consensus.Transaction) (err error)

AcceptTransaction takes a new transaction from the network and puts it in the transaction pool after checking it for legality and consistency.

func (*TransactionPool) IsStandardTransaction

func (tp *TransactionPool) IsStandardTransaction(t consensus.Transaction) (err error)

standard implements the rules outlined in Standard.md, and will return an error if any of the rules are violated.

func (*TransactionPool) TransactionSet

func (tp *TransactionPool) TransactionSet() (transactionSet []consensus.Transaction, err error)

TransactionSet will return a list of transactions that can be put in a block in order, and will not result in the block being too large. TransactionSet prioritizes transactions that have already been in a block (on another fork), and then treats remaining transactions in a first come first serve manner.

func (*TransactionPool) UnconfirmedSiacoinOutputDiffs

func (tp *TransactionPool) UnconfirmedSiacoinOutputDiffs() (scods []consensus.SiacoinOutputDiff)

UnconfirmedSiacoinOutputDiffs returns the set of siacoin output diffs that would be created immediately if all of the unconfirmed transactions were added to the blockchain.

Jump to

Keyboard shortcuts

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