mempool

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2017 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MempoolChannel = byte(0x30)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Mempool

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

func NewMempool

func NewMempool(config cfg.Config, proxyAppConn proxy.AppConnMempool) *Mempool

func (*Mempool) CheckTx

func (mem *Mempool) CheckTx(tx types.Tx, cb func(*abci.Response)) (err error)

Try a new transaction in the mempool. Potentially blocking if we're blocking on Update() or Reap(). cb: A callback from the CheckTx command.

It gets called from another goroutine.

CONTRACT: Either cb will get called, or err returned.

func (*Mempool) Flush

func (mem *Mempool) Flush()

Remove all transactions from mempool and cache

func (*Mempool) Lock

func (mem *Mempool) Lock()

consensus must be able to hold lock to safely update

func (*Mempool) Reap added in v0.7.0

func (mem *Mempool) Reap(maxTxs int) []types.Tx

Get the valid transactions remaining If maxTxs is -1, there is no cap on returned transactions.

func (*Mempool) Size

func (mem *Mempool) Size() int

Number of transactions in the mempool clist

func (*Mempool) TxsFrontWait added in v0.7.0

func (mem *Mempool) TxsFrontWait() *clist.CElement

Return the first element of mem.txs for peer goroutines to call .NextWait() on. Blocks until txs has elements.

func (*Mempool) Unlock

func (mem *Mempool) Unlock()

func (*Mempool) Update

func (mem *Mempool) Update(height int, txs []types.Tx)

Tell mempool that these txs were committed. Mempool will discard these txs. NOTE: this should be called *after* block is committed by consensus. NOTE: unsafe; Lock/Unlock must be managed by caller

type MempoolMessage

type MempoolMessage interface{}

func DecodeMessage added in v0.7.0

func DecodeMessage(bz []byte) (msgType byte, msg MempoolMessage, err error)

type MempoolReactor

type MempoolReactor struct {
	p2p.BaseReactor

	Mempool *Mempool
	// contains filtered or unexported fields
}

MempoolReactor handles mempool tx broadcasting amongst peers.

func NewMempoolReactor

func NewMempoolReactor(config cfg.Config, mempool *Mempool) *MempoolReactor

func (*MempoolReactor) AddPeer

func (memR *MempoolReactor) AddPeer(peer *p2p.Peer)

Implements Reactor

func (*MempoolReactor) BroadcastTx added in v0.7.0

func (memR *MempoolReactor) BroadcastTx(tx types.Tx, cb func(*abci.Response)) error

Just an alias for CheckTx since broadcasting happens in peer routines

func (*MempoolReactor) GetChannels

func (memR *MempoolReactor) GetChannels() []*p2p.ChannelDescriptor

Implements Reactor

func (*MempoolReactor) Receive

func (memR *MempoolReactor) Receive(chID byte, src *p2p.Peer, msgBytes []byte)

Implements Reactor

func (*MempoolReactor) RemovePeer

func (memR *MempoolReactor) RemovePeer(peer *p2p.Peer, reason interface{})

Implements Reactor

func (*MempoolReactor) SetEventSwitch added in v0.7.0

func (memR *MempoolReactor) SetEventSwitch(evsw types.EventSwitch)

implements events.Eventable

type Peer added in v0.7.0

type Peer interface {
	IsRunning() bool
	Send(byte, interface{}) bool
	Get(string) interface{}
}

type PeerState

type PeerState interface {
	GetHeight() int
}

type TxMessage

type TxMessage struct {
	Tx types.Tx
}

func (*TxMessage) String

func (m *TxMessage) String() string

Jump to

Keyboard shortcuts

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