Merge pull request #750 from tendermint/feature/cleanup

Cleanup of code and code docs
This commit is contained in:
Ethan Buchman
2017-10-23 11:14:15 -04:00
committed by GitHub
9 changed files with 121 additions and 84 deletions
+6 -6
View File
@@ -50,9 +50,10 @@ TODO: Better handle abci client errors. (make it automatically handle connection
const cacheSize = 100000
// Mempool is an ordered in-memory pool for transactions before they are proposed in a consensus round.
// Transaction validity is checked using the CheckTx abci message before the transaction is added to the pool.
// The Mempool uses a concurrent list structure for storing transactions that can be efficiently accessed by multiple concurrent readers.
// Mempool is an ordered in-memory pool for transactions before they are proposed in a consensus
// round. Transaction validity is checked using the CheckTx abci message before the transaction is
// added to the pool. The Mempool uses a concurrent list structure for storing transactions that
// can be efficiently accessed by multiple concurrent readers.
type Mempool struct {
config *cfg.MempoolConfig
@@ -78,6 +79,7 @@ type Mempool struct {
}
// NewMempool returns a new Mempool with the given configuration and connection to an application.
// TODO: Extract logger into arguments.
func NewMempool(config *cfg.MempoolConfig, proxyAppConn proxy.AppConnMempool, height int) *Mempool {
mempool := &Mempool{
config: config,
@@ -290,9 +292,7 @@ func (mem *Mempool) notifyTxsAvailable() {
if mem.Size() == 0 {
panic("notified txs available but mempool is empty!")
}
if mem.txsAvailable != nil &&
!mem.notifiedTxsAvailable {
if mem.txsAvailable != nil && !mem.notifiedTxsAvailable {
mem.notifiedTxsAvailable = true
mem.txsAvailable <- mem.height + 1
}