mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-26 09:54:19 +00:00
move Mempool interface into mempool package
Refs #2659 Breaking changes in the mempool package: - Mempool now an interface - old Mempool renamed to CListMempool Breaking changes to state package: - MockMempool moved to mempool/mock package and renamed to Mempool - Mempool interface moved to mempool package
This commit is contained in:
@@ -249,7 +249,8 @@ func TestAppCalls(t *testing.T) {
|
||||
func TestBroadcastTxSync(t *testing.T) {
|
||||
require := require.New(t)
|
||||
|
||||
mempool := node.MempoolReactor().Mempool
|
||||
// TODO (melekes): use mempool which is set on RPC rather than getting it from node
|
||||
mempool := node.Mempool()
|
||||
initMempoolSize := mempool.Size()
|
||||
|
||||
for i, c := range GetClients() {
|
||||
@@ -269,7 +270,7 @@ func TestBroadcastTxSync(t *testing.T) {
|
||||
func TestBroadcastTxCommit(t *testing.T) {
|
||||
require := require.New(t)
|
||||
|
||||
mempool := node.MempoolReactor().Mempool
|
||||
mempool := node.Mempool()
|
||||
for i, c := range GetClients() {
|
||||
_, _, tx := MakeTxKV()
|
||||
bres, err := c.BroadcastTxCommit(tx)
|
||||
@@ -284,7 +285,7 @@ func TestBroadcastTxCommit(t *testing.T) {
|
||||
func TestUnconfirmedTxs(t *testing.T) {
|
||||
_, _, tx := MakeTxKV()
|
||||
|
||||
mempool := node.MempoolReactor().Mempool
|
||||
mempool := node.Mempool()
|
||||
_ = mempool.CheckTx(tx, nil)
|
||||
|
||||
for i, c := range GetClients() {
|
||||
@@ -305,7 +306,7 @@ func TestUnconfirmedTxs(t *testing.T) {
|
||||
func TestNumUnconfirmedTxs(t *testing.T) {
|
||||
_, _, tx := MakeTxKV()
|
||||
|
||||
mempool := node.MempoolReactor().Mempool
|
||||
mempool := node.Mempool()
|
||||
_ = mempool.CheckTx(tx, nil)
|
||||
mempoolSize := mempool.Size()
|
||||
|
||||
|
||||
+10
-2
@@ -49,6 +49,14 @@ type peers interface {
|
||||
Peers() p2p.IPeerSet
|
||||
}
|
||||
|
||||
// Mempool extends the standard Mempool interface to allow getting
|
||||
// total txs size. ReapMaxTxs is used by UnconfirmedTxs to reap N transactions.
|
||||
type Mempool interface {
|
||||
mempl.Mempool
|
||||
ReapMaxTxs(n int) types.Txs
|
||||
TxsBytes() int64
|
||||
}
|
||||
|
||||
//----------------------------------------------
|
||||
// These package level globals come with setters
|
||||
// that are expected to be called only once, on startup
|
||||
@@ -72,7 +80,7 @@ var (
|
||||
txIndexer txindex.TxIndexer
|
||||
consensusReactor *consensus.ConsensusReactor
|
||||
eventBus *types.EventBus // thread safe
|
||||
mempool *mempl.Mempool
|
||||
mempool Mempool
|
||||
|
||||
logger log.Logger
|
||||
|
||||
@@ -87,7 +95,7 @@ func SetBlockStore(bs sm.BlockStore) {
|
||||
blockStore = bs
|
||||
}
|
||||
|
||||
func SetMempool(mem *mempl.Mempool) {
|
||||
func SetMempool(mem Mempool) {
|
||||
mempool = mem
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user