mempool

package
v0.0.0-...-9259d71 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2018 License: BSD-2-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DisableLog

func DisableLog()

DisableLog disableLog

func SetLogLevel

func SetLogLevel(level string)

SetLogLevel set log level

Types

type Item

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

Item 为Mempool中包装交易的数据结构

type Mempool

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

Mempool mempool module

func New

func New(cfg *types.MemPool) *Mempool

New new mempool

func (*Mempool) BlockTime

func (mem *Mempool) BlockTime() int64

BlockTime 获取区块时间

func (*Mempool) CheckExpireValid

func (mem *Mempool) CheckExpireValid(msg queue.Message) (bool, error)

CheckExpireValid 检查交易过期有效性,过期返回false,未过期返回true

func (*Mempool) CheckTxs

func (mem *Mempool) CheckTxs(msg queue.Message) queue.Message

CheckTxs 初步检查并筛选交易消息

func (*Mempool) Close

func (mem *Mempool) Close()

Close 关闭Mempool

func (*Mempool) DelBlock

func (mem *Mempool) DelBlock(block *types.Block)

DelBlock 将回退的区块内的交易重新加入mempool中

func (*Mempool) GetAccTxs

func (mem *Mempool) GetAccTxs(addrs *types.ReqAddrs) *types.TransactionDetails

GetAccTxs 用来获取对应账户地址(列表)中的全部交易详细信息

func (*Mempool) GetHeader

func (mem *Mempool) GetHeader() *types.Header

GetHeader 获取Mempool.header

func (*Mempool) GetLastHeader

func (mem *Mempool) GetLastHeader() (interface{}, error)

GetLastHeader 获取LastHeader的height和blockTime

func (*Mempool) GetLatestTx

func (mem *Mempool) GetLatestTx() []*types.Transaction

GetLatestTx 返回最新十条加入到Mempool的交易

func (*Mempool) GetMinFee

func (mem *Mempool) GetMinFee() int64

GetMinFee 获取最小交易费用

func (*Mempool) GetTxList

func (mem *Mempool) GetTxList(hashList *types.TxHashList) []*types.Transaction

GetTxList 从txCache中返回给定数目的tx

func (*Mempool) Height

func (mem *Mempool) Height() int64

Height 获取区块高度

func (*Mempool) PushTx

func (mem *Mempool) PushTx(tx *types.Transaction) error

PushTx 将交易推入Mempool,并返回结果(error)

func (*Mempool) ReTry

func (mem *Mempool) ReTry()

ReTry 检查Mempool,将未过期的交易重发送给P2P

func (*Mempool) ReTrySend

func (mem *Mempool) ReTrySend()

ReTrySend 每隔两分钟运行一次ReTry

func (*Mempool) RemoveBlockedTxs

func (mem *Mempool) RemoveBlockedTxs()

RemoveBlockedTxs 每隔1分钟清理一次已打包的交易

func (*Mempool) RemoveExpiredAndDuplicateMempoolTxs

func (mem *Mempool) RemoveExpiredAndDuplicateMempoolTxs() []*types.Transaction

RemoveExpiredAndDuplicateMempoolTxs 删除过期交易然后复制并返回Mempool内交易

func (*Mempool) RemoveTxs

func (mem *Mempool) RemoveTxs(hashList *types.TxHashList) error

RemoveTxs 从Mempool中删除给定Hash的txs

func (*Mempool) RemoveTxsOfBlock

func (mem *Mempool) RemoveTxsOfBlock(block *types.Block) bool

RemoveTxsOfBlock 移除Mempool中已被Blockchain打包的tx

func (*Mempool) Resize

func (mem *Mempool) Resize(size int)

Resize 设置Mempool容量

func (*Mempool) SendTxToP2P

func (mem *Mempool) SendTxToP2P(tx *types.Transaction)

SendTxToP2P 向"p2p"发送消息

func (*Mempool) SetMinFee

func (mem *Mempool) SetMinFee(fee int64)

SetMinFee 设置最小交易费用

func (*Mempool) SetQueueClient

func (mem *Mempool) SetQueueClient(client queue.Client)

SetQueueClient set client queue, for recv msg

func (*Mempool) SetSync

func (mem *Mempool) SetSync(status bool)

SetSync 设置Mempool同步状态

func (*Mempool) Size

func (mem *Mempool) Size() int

Size 返回Mempool中txCache大小

func (*Mempool) TxNumOfAccount

func (mem *Mempool) TxNumOfAccount(addr string) int64

TxNumOfAccount 返回账户在Mempool中交易数量

func (*Mempool) WaitPollLastHeader

func (mem *Mempool) WaitPollLastHeader()

WaitPollLastHeader 等待获取到最新高度

Jump to

Keyboard shortcuts

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