diff --git a/mempool/clist_mempool.go b/mempool/clist_mempool.go index bbff3b98f..b6694c9b2 100644 --- a/mempool/clist_mempool.go +++ b/mempool/clist_mempool.go @@ -194,15 +194,10 @@ func (mem *CListMempool) Flush() { _ = atomic.SwapInt64(&mem.txsBytes, 0) } -// TxsFront returns the first transaction in the ordered list for peer -// goroutines to call .NextWait() on. func (mem *CListMempool) TxsFront() *clist.CElement { return mem.txs.Front() } -// TxsWaitChan returns a channel to wait on transactions. It will be closed -// once the mempool is not empty (ie. the internal `mem.txs` has at least one -// element) func (mem *CListMempool) TxsWaitChan() <-chan struct{} { return mem.txs.WaitChan() } diff --git a/mempool/mempool.go b/mempool/mempool.go index 6a789f26d..b04f3f68c 100644 --- a/mempool/mempool.go +++ b/mempool/mempool.go @@ -35,8 +35,14 @@ type Mempool interface { // transactions (~ all available transactions). ReapMaxTxs(max int) types.Txs - // UNSAFE + // TxsWaitChan returns a channel to wait on transactions. It will be closed + // once the mempool is not empty (ie. the internal `mem.txs` has at least one + // element) TxsWaitChan() <-chan struct{} + + // TxsFront returns the first transaction in the ordered list for peer + // goroutines to call .NextWait() on. + // FIXME: leaking implementation details! TxsFront() *clist.CElement // Lock locks the mempool. The consensus must be able to hold lock to safely update.