Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mempool: Split into more well-defined components #1741

Merged
merged 3 commits into from
May 7, 2024
Merged

Conversation

iljakuklic
Copy link
Contributor

This is a refactoring of mempool that splits it into multiple better isolated components with more well defined interfaces between them.

  • Top-level mempool acts as a coordinator and contains the other two as subcomponents. It also manages the emission of events and the contents of the orphan work queue. Upon reception of a transaction, it first attempts it to add to the transaction pool, and if it is rejected, it tries to add it to the orphan pool. If it's rejected by both, the transaction is rejected for good.
  • Transaction pool is the main mempool component. It holds transactions and keeps track of the utxo set defined by the transactions in the pool. It is also responsible for validating transactions upon insertion.
  • The orphan pool is a temporary holding space for transaction for which we do not know the complete set of parents.

Some other minor changes are also included:

  • Remove Arc from around MempoolConfig (not needed)
  • Move some definitions to more logical places

Copy link
Contributor

@TheQuantumPhysicist TheQuantumPhysicist left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Besides the comments, looks OK.

@iljakuklic iljakuklic force-pushed the mempool-split branch 2 times, most recently from c7190c4 to fa78af2 Compare May 1, 2024 14:05
Copy link
Member

@azarovh azarovh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't provide any valuable feedback except that it looks reasonable

This is a refactoring of mempool that splits it into multiple better
isolated components with more well defined interfaces between them.

* Top-level mempool acts as a coordinator and contains the other two as
  subcomponents. It also manages the emission of events and the contents
  of the orphan work queue. Upon reception of a transaction, it first
  attempts it to add to the transaction pool, and if it is rejected, it
  tries to add it to the orphan pool. If it's rejected by both, the
  transaction is rejected for good.
* Transaction pool is the main mempool component. It holds transactions
  and keeps track of the utxo set defined by the transactions in the
  pool. It is also responsible for validating transactions upon
  insertion.
* The orphan pool is a temporary holding space for transaction for which
  we do not know the complete set of parents.

Some other minor changes are also included:
* Remove `Arc` from around `MempoolConfig` (not needed)
* Move some definitions to more logical places
@iljakuklic iljakuklic merged commit 6083ee1 into master May 7, 2024
23 checks passed
@iljakuklic iljakuklic deleted the mempool-split branch May 7, 2024 07:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants