-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Description
Currently the mempool interface is defined in the state package. This has a couple downsides, one is that the mempool package can't compile time check that it implements the desired interface. Additionally its non-intuitive where the interface is getting defined. This originally made more sense as it was to avoid state having to import the mempool package, but now it has to anyway for the precheck filters.
I propose that we make the mempool package a similar design pattern to the crypto package. We would have the interfaces defined in /mempool, along with the common precheck filters. We then have a separate package for every mempool implementation. This allows us to more easily experiment with / build out the new mempool data structures iteratively, and that nodes can elect to run different versions. It also helps for nodes who want to modify the mempool, which is a fairly natural thing to expect nodes to want to do.
state and node would only know about the top level package import, and therefore not import any of the implementation detail-specific mempool code as well.