Tendermint: why use the mock.Mempool{} to initialize the blockExec

Created on 29 Apr 2020  路  3Comments  路  Source: tendermint/tendermint

Tendermint version (use tendermint version or git rev-parse --verify HEAD if installed from source): 569981325a43c18e65beb193adf7d172a498a5bc

What happened:

  • consensus\replay.go line 476 : blockExec := sm.NewBlockExecutor(h.stateDB, h.logger, proxyApp, mock.Mempool{}, sm.MockEvidencePool{})
  • Why use the mock.Mempool{} to initialize the blockExec? I notice that the comment showing that Mempool is used for test
  • if I add some functions in the interface Mempool, the structure CListMempool is easy to achieve the additional functions, but the structure Mempool is a empty struct. So it is hard for me to achieve the logic code.

What you expected to happen:

  • use the CListMempool to initialize the blockExec
consensus question

Most helpful comment

It's weird that test code was used in production code.

All 3 comments

It's weird that test code was used in production code.

It's simple. Because we don't need both of them (mempool and evidence pool) during replay (replaying missing blocks to application). mempool - we don't need to reap transactions. evidence pool - we don't need to reap evidence. block is already there (created before), Tendermint just replaying it to the application.

I hope https://github.com/tendermint/tendermint/pull/4785 clarifies things a bit. Thanks for bringing this to our attention!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ebuchman picture ebuchman  路  3Comments

adrianbrink picture adrianbrink  路  3Comments

liamsi picture liamsi  路  3Comments

melekes picture melekes  路  4Comments

ebuchman picture ebuchman  路  3Comments