Documentation ¶
Index ¶
- Constants
- Variables
- type TransactionPool
- func (tp *TransactionPool) AcceptTransaction(t consensus.Transaction) (err error)
- func (tp *TransactionPool) IsStandardTransaction(t consensus.Transaction) (err error)
- func (tp *TransactionPool) TransactionSet() (transactionSet []consensus.Transaction, err error)
- func (tp *TransactionPool) UnconfirmedSiacoinOutputDiffs() (scods []consensus.SiacoinOutputDiff)
Constants ¶
const ( FileContractConfirmWindow = 10 TransactionSizeLimit = 16 * 1024 PrefixNonSia = "NonSia" )
Variables ¶
var (
ErrDoubleSpend = errors.New("transaction spends an output that was spent by another transaction in the pool")
)
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 (*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.