Documentation ¶
Index ¶
- Variables
- type Manager
- func (m *Manager) AcceptBlock(b types.Block) error
- func (m *Manager) BlockAtHeight(height uint64) (types.Block, bool)
- func (m *Manager) Close() error
- func (m *Manager) IndexAtHeight(height uint64) (types.ChainIndex, error)
- func (m *Manager) Network() string
- func (m *Manager) PoolTransactions() []types.Transaction
- func (m *Manager) ProcessConsensusChange(cc modules.ConsensusChange)
- func (m *Manager) Subscribe(s modules.ConsensusSetSubscriber, ccID modules.ConsensusChangeID, ...) error
- func (m *Manager) Synced() bool
- func (m *Manager) TipState() consensus.State
- type TransactionPool
- func (tp *TransactionPool) AcceptTransactionSet(txns []types.Transaction) error
- func (tp *TransactionPool) Close() error
- func (tp *TransactionPool) RecommendedFee() (fee types.Currency)
- func (tp *TransactionPool) Subscribe(s modules.TransactionPoolSubscriber)
- func (tp *TransactionPool) Transactions() []types.Transaction
- func (tp *TransactionPool) UnconfirmedParents(txn types.Transaction) ([]types.Transaction, error)
Constants ¶
This section is empty.
Variables ¶
var ( // ErrBlockNotFound is returned when a block is not found. ErrBlockNotFound = errors.New("block not found") // ErrInvalidChangeID is returned to a subscriber when the change id is // invalid. ErrInvalidChangeID = errors.New("invalid change id") )
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
A Manager manages the current state of the blockchain.
func NewManager ¶
func NewManager(cs modules.ConsensusSet, tp *TransactionPool) (*Manager, error)
NewManager creates a new chain manager.
func (*Manager) AcceptBlock ¶
AcceptBlock adds b to the consensus set.
func (*Manager) BlockAtHeight ¶
BlockAtHeight returns the block at the given height.
func (*Manager) IndexAtHeight ¶
func (m *Manager) IndexAtHeight(height uint64) (types.ChainIndex, error)
IndexAtHeight return the chain index at the given height.
func (*Manager) PoolTransactions ¶ added in v1.1.0
func (m *Manager) PoolTransactions() []types.Transaction
PoolTransactions returns all transactions in the transaction pool
func (*Manager) ProcessConsensusChange ¶
func (m *Manager) ProcessConsensusChange(cc modules.ConsensusChange)
ProcessConsensusChange implements the modules.ConsensusSetSubscriber interface.
func (*Manager) Subscribe ¶
func (m *Manager) Subscribe(s modules.ConsensusSetSubscriber, ccID modules.ConsensusChangeID, cancel <-chan struct{}) error
Subscribe subscribes to the consensus set.
type TransactionPool ¶
type TransactionPool struct {
// contains filtered or unexported fields
}
TransactionPool wraps the siad transaction pool with a more convenient API.
func NewTPool ¶
func NewTPool(tp modules.TransactionPool) *TransactionPool
NewTPool wraps a siad transaction pool with a more convenient API.
func (*TransactionPool) AcceptTransactionSet ¶
func (tp *TransactionPool) AcceptTransactionSet(txns []types.Transaction) error
AcceptTransactionSet adds a transaction set to the tpool and broadcasts it to the network.
func (*TransactionPool) Close ¶
func (tp *TransactionPool) Close() error
Close closes the transaction pool.
func (*TransactionPool) RecommendedFee ¶
func (tp *TransactionPool) RecommendedFee() (fee types.Currency)
RecommendedFee returns the recommended fee per byte.
func (*TransactionPool) Subscribe ¶
func (tp *TransactionPool) Subscribe(s modules.TransactionPoolSubscriber)
Subscribe subscribes to the transaction pool.
func (*TransactionPool) Transactions ¶
func (tp *TransactionPool) Transactions() []types.Transaction
Transactions returns the transactions in the transaction pool.
func (*TransactionPool) UnconfirmedParents ¶
func (tp *TransactionPool) UnconfirmedParents(txn types.Transaction) ([]types.Transaction, error)
UnconfirmedParents returns the unconfirmed parents of a transaction.