github.com/DFWallet/tendermint-cosmos@v0.0.2/mempool/doc.go (about)

     1  // The mempool pushes new txs onto the proxyAppConn.
     2  // It gets a stream of (req, res) tuples from the proxy.
     3  // The mempool stores good txs in a concurrent linked-list.
     4  
     5  // Multiple concurrent go-routines can traverse this linked-list
     6  // safely by calling .NextWait() on each element.
     7  
     8  // So we have several go-routines:
     9  // 1. Consensus calling Update() and ReapMaxBytesMaxGas() synchronously
    10  // 2. Many mempool reactor's peer routines calling CheckTx()
    11  // 3. Many mempool reactor's peer routines traversing the txs linked list
    12  
    13  // To manage these goroutines, there are three methods of locking.
    14  // 1. Mutations to the linked-list is protected by an internal mtx (CList is goroutine-safe)
    15  // 2. Mutations to the linked-list elements are atomic
    16  // 3. CheckTx() and/or ReapMaxBytesMaxGas() calls can be paused upon Update(), protected by .updateMtx
    17  
    18  // Garbage collection of old elements from mempool.txs is handlde via the
    19  // DetachPrev() call, which makes old elements not reachable by peer
    20  // broadcastTxRoutine().
    21  
    22  // TODO: Better handle abci client errors. (make it automatically handle connection errors)
    23  package mempool