Skip to content

mempool: Move interface to mempool package #2659

@ValarDragon

Description

@ValarDragon

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.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions