mempool

package
v0.0.0-...-7c12c5a Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2015 License: GPL-2.0, GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

This section is empty.

Types

type Mempool

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

func NewMempool

func NewMempool(state *sm.State) *Mempool

func (*Mempool) AddTx

func (mem *Mempool) AddTx(tx types.Tx) (err error)

Apply tx to the state and remember it.

func (*Mempool) GetCache

func (mem *Mempool) GetCache() *sm.BlockCache

func (*Mempool) GetHeight

func (mem *Mempool) GetHeight() int

func (*Mempool) GetProposalTxs

func (mem *Mempool) GetProposalTxs() []types.Tx

func (*Mempool) GetState

func (mem *Mempool) GetState() *sm.State

func (*Mempool) ResetForBlockAndState

func (mem *Mempool) ResetForBlockAndState(block *types.Block, state *sm.State) ResetInfo

"block" is the new block being committed. "state" is the result of state.AppendBlock("block"). Txs that are present in "block" are discarded from mempool. Txs that have become invalid in the new "state" are also discarded.

type MempoolMessage

type MempoolMessage interface{}

func DecodeMessage

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(mempool *Mempool) *MempoolReactor

func (*MempoolReactor) AddPeer

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

Implements Reactor

func (*MempoolReactor) BroadcastTx

func (memR *MempoolReactor) BroadcastTx(tx types.Tx) error

Just an alias for AddTx 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) ResetForBlockAndState

func (memR *MempoolReactor) ResetForBlockAndState(block *types.Block, state *sm.State)

"block" is the new block being committed. "state" is the result of state.AppendBlock("block"). Txs that are present in "block" are discarded from mempool. Txs that have become invalid in the new "state" are also discarded.

func (*MempoolReactor) SetFireable

func (memR *MempoolReactor) SetFireable(evsw events.Fireable)

implements events.Eventable

type Peer

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

type PeerState

type PeerState interface {
	GetHeight() int
}

type Range

type Range struct {
	Start  int
	Length int
}

type ResetInfo

type ResetInfo struct {
	Height   int
	Included []Range
	Invalid  []Range
}

We use this to inform peer routines of how the mempool has been updated

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