You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.3 KiB

mempool: move interface into mempool package (#3524) ## 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 1bfceacd9d65a720574683a7f22771e69af9af4d. * 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
6 years ago
  1. package mock
  2. import (
  3. abci "github.com/tendermint/tendermint/abci/types"
  4. "github.com/tendermint/tendermint/libs/clist"
  5. mempl "github.com/tendermint/tendermint/mempool"
  6. "github.com/tendermint/tendermint/types"
  7. )
  8. // Mempool is an empty implementation of a Mempool, useful for testing.
  9. type Mempool struct{}
  10. var _ mempl.Mempool = Mempool{}
  11. func (Mempool) Lock() {}
  12. func (Mempool) Unlock() {}
  13. func (Mempool) Size() int { return 0 }
  14. func (Mempool) CheckTx(_ types.Tx, _ func(*abci.Response)) error {
  15. return nil
  16. }
  17. func (Mempool) CheckTxWithInfo(_ types.Tx, _ func(*abci.Response),
  18. _ mempl.TxInfo) error {
  19. return nil
  20. }
  21. func (Mempool) ReapMaxBytesMaxGas(_, _ int64) types.Txs { return types.Txs{} }
  22. func (Mempool) ReapMaxTxs(n int) types.Txs { return types.Txs{} }
  23. func (Mempool) Update(
  24. _ int64,
  25. _ types.Txs,
  26. _ mempl.PreCheckFunc,
  27. _ mempl.PostCheckFunc,
  28. ) error {
  29. return nil
  30. }
  31. func (Mempool) Flush() {}
  32. func (Mempool) FlushAppConn() error { return nil }
  33. func (Mempool) TxsAvailable() <-chan struct{} { return make(chan struct{}) }
  34. func (Mempool) EnableTxsAvailable() {}
  35. func (Mempool) TxsBytes() int64 { return 0 }
  36. func (Mempool) TxsFront() *clist.CElement { return nil }
  37. func (Mempool) TxsWaitChan() <-chan struct{} { return nil }
  38. func (Mempool) InitWAL() {}
  39. func (Mempool) CloseWAL() {}