-
The mempool is designed to hold a list of unconfirmed-but-valid transactions that the node has learned about.
-
Miners will select transactions from the mempool for assembly into a block using the
getblocktemplate
RPC. -
Transactions have to pass all policy and validation checks before being allowed to enter the mempool.
The mempool therefore also acts as DoS protection for the node. -
Transactions will not be added to the mempool if they do not meet fee requirements, are non-standard, or double-spend an input of a transaction already in the mempool (excluding BIP 125 RBF transactions).
There is a bitcoin-devwiki page Mempool and mining which includes some additional mempool philosophy.
James O’Beirne has written a comprehensive overview of the current challenges and work in mempool design. It "documents the existing design, failures, and vulnerabilities of the mempool as well as some proposals that exist to remedy the shortcomings."
The documentation subfolder doc/policy contains up-to-date information on some, but not all, of the current mempool policy rules.