mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-03 11:45:18 +00:00
## Description
Refs #2659
Breaking changes in the mempool package:
[mempool] #2659 Mempool now an interface
old Mempool renamed to CListMempool
NewMempool renamed to NewCListMempool
Option renamed to CListOption
MempoolReactor renamed to Reactor
NewMempoolReactor renamed to NewReactor
unexpose TxID method
TxInfo.PeerID renamed to SenderID
unexpose MempoolReactor.Mempool
Breaking changes in the state package:
[state] #2659 Mempool interface moved to mempool package
MockMempool moved to top-level mock package and renamed to Mempool
Non Breaking changes in the node package:
[node] #2659 Add Mempool method, which allows you to access mempool
## Commits
* 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
* assert CListMempool impl Mempool
* gofmt code
* rename MempoolReactor to Reactor
- combine everything into one interface
- rename TxInfo.PeerID to TxInfo.SenderID
- unexpose MempoolReactor.Mempool
* move mempool mock into top-level mock package
* add a fixme
TxsFront should not be a part of the Mempool interface
because it leaks implementation details. Instead, we need to come up
with general interface for querying the mempool so the MempoolReactor
can fetch and broadcast txs to peers.
* change node#Mempool to return interface
* save commit = new reactor arch
* Revert "save commit = new reactor arch"
This reverts commit 1bfceacd9d.
* require CListMempool in mempool.Reactor
* add two changelog entries
* fixes after my own review
* quote interfaces, structs and functions
* fixes after Ismail's review
* make node's mempool an interface
* make InitWAL/CloseWAL methods a part of Mempool interface
* fix merge conflicts
* make node's mempool an interface
25 lines
1.2 KiB
Go
25 lines
1.2 KiB
Go
// The mempool pushes new txs onto the proxyAppConn.
|
|
// It gets a stream of (req, res) tuples from the proxy.
|
|
// The mempool stores good txs in a concurrent linked-list.
|
|
|
|
// Multiple concurrent go-routines can traverse this linked-list
|
|
// safely by calling .NextWait() on each element.
|
|
|
|
// So we have several go-routines:
|
|
// 1. Consensus calling Update() and Reap() synchronously
|
|
// 2. Many mempool reactor's peer routines calling CheckTx()
|
|
// 3. Many mempool reactor's peer routines traversing the txs linked list
|
|
// 4. Another goroutine calling GarbageCollectTxs() periodically
|
|
|
|
// To manage these goroutines, there are three methods of locking.
|
|
// 1. Mutations to the linked-list is protected by an internal mtx (CList is goroutine-safe)
|
|
// 2. Mutations to the linked-list elements are atomic
|
|
// 3. CheckTx() calls can be paused upon Update() and Reap(), protected by .proxyMtx
|
|
|
|
// Garbage collection of old elements from mempool.txs is handlde via
|
|
// the DetachPrev() call, which makes old elements not reachable by
|
|
// peer broadcastTxRoutine() automatically garbage collected.
|
|
|
|
// TODO: Better handle abci client errors. (make it automatically handle connection errors)
|
|
package mempool
|