Mempool Expiry
Mempool expiry removes unconfirmed transactions from a node's mempool after a configurable time period, typically 14 days.
Key Takeaways
- Bitcoin Core drops unconfirmed transactions from the mempool after 336 hours (14 days) by default, freeing memory and preventing unbounded growth.
- Mempool expiry is time-based and operates independently of size-based mempool eviction, which removes the lowest-feerate packages when the pool exceeds its memory cap.
- Expired transactions are not invalid: they can be rebroadcast with the same or higher fee. Users can also use Replace-by-Fee (RBF) before expiry to bump a stuck transaction into the next block.
What Is Mempool Expiry?
Mempool expiry is a policy rule in Bitcoin Core that automatically removes unconfirmed transactions from a node's mempool after they have been waiting for a configurable amount of time. The default expiry window is 336 hours, or exactly 14 days. If a transaction enters the mempool and remains unconfirmed for two weeks, the node discards it as if it had never been received.
This mechanism exists because the mempool is a shared, in-memory data structure that every full node maintains. Without time-based cleanup, low-fee transactions submitted during quiet periods could linger indefinitely, consuming RAM and increasing the cost of running a full node. Expiry ensures that the mempool reflects transactions with a realistic chance of being mined, not an archaeological record of every broadcast ever received.
It is important to understand that mempool expiry is a local policy decision, not a consensus rule. The Bitcoin protocol itself does not enforce transaction lifetimes. Different nodes can set different expiry thresholds, and a transaction dropped by one node may still exist in another node's mempool. The transaction remains valid on the network as long as its inputs have not been spent.
How It Works
Bitcoin Core checks for expired transactions during its periodic mempool maintenance routine, which runs alongside size-limit enforcement. The process is straightforward:
- When a transaction enters the mempool, the node records its entry time
- During each maintenance pass, the node compares every transaction's entry time against the current time
- Any transaction whose age exceeds the configured expiry threshold is removed unconditionally, regardless of its feerate or position in the mempool
- Descendant transactions (those spending outputs of the expired transaction) are also removed
The expiry check does not consider whether the transaction might be mineable. A transaction paying a competitive feerate that simply had bad luck for 14 days is treated the same as a dust-fee transaction that was never going to confirm.
Configuration
Node operators can adjust the expiry window using the -mempoolexpiry startup option, which accepts a value in hours. The default is defined in Bitcoin Core's source code as a named constant:
// src/kernel/mempool_options.h
static constexpr unsigned int DEFAULT_MEMPOOL_EXPIRY_HOURS{336};To change the expiry to 7 days (168 hours), for example:
bitcoind -mempoolexpiry=168Or in bitcoin.conf:
mempoolexpiry=168Setting a shorter expiry reduces memory usage but may cause the node to drop transactions that other nodes still hold. Setting a longer expiry keeps transactions around for more time but increases memory consumption. Most operators leave the default unchanged.
Expiry vs. Eviction
Bitcoin Core uses two distinct mechanisms to manage mempool size, and understanding the difference is essential:
| Mechanism | Trigger | What Gets Removed | Default Threshold |
|---|---|---|---|
| Time-based expiry | Transaction age exceeds limit | Any transaction past the time threshold | 336 hours (14 days) |
| Size-based eviction | Mempool exceeds memory cap | Lowest-feerate transaction packages | 300 MB (-maxmempool) |
Size-based eviction is market-driven: when the mempool is full, only the least competitive transactions are dropped to make room for higher-fee replacements. It also raises the node's dynamic minimum relay fee, temporarily rejecting new transactions below the eviction threshold.
Expiry, by contrast, is purely calendar-based. It fires regardless of how full the mempool is. During low-congestion periods when the mempool is well under its size cap, expiry is the only mechanism removing old transactions.
Why It Matters
Mempool expiry has practical consequences for anyone sending or receiving Bitcoin transactions:
- Node resource management: without expiry, a node's mempool would grow monotonically during extended low-fee periods, eventually consuming all available RAM
- Transaction reliability: users who broadcast a low-fee transaction and walk away may find it has disappeared from most mempools after two weeks, requiring rebroadcast
- Wallet behavior: Bitcoin Core's built-in wallet automatically rebroadcasts its own transactions to prevent them from being lost to expiry, but third-party wallets may not
- Fee market signals: expired transactions stop contributing to mempool depth charts and fee estimation algorithms, giving miners a cleaner view of actual demand
For layer-2 protocols like Spark and the Lightning Network, mempool expiry is less of a concern because most activity happens off-chain. However, on-chain settlement transactions (such as channel opens, closes, or splices) still interact with mempool policy and must account for expiry if they carry low fees during congestion.
Use Cases
Recovering Stuck Transactions
When a transaction is stuck in the mempool with a fee too low to confirm, users have several options. The most direct approach is fee bumping via RBF or CPFP before the transaction expires. If the user does nothing and the transaction expires from all nodes, they can simply create a new transaction spending the same inputs with an appropriate fee.
After expiry, the original UTXOs become "available" again from the wallet's perspective: since no mempool transaction is spending them, the wallet can construct a fresh transaction. This is functionally equivalent to RBF, except that the user does not need to meet the replacement feerate rules because the original is no longer in the mempool.
Mempool Hygiene for Node Operators
Node operators running infrastructure services (block explorers, fee estimators, or mining pool backends) may tighten expiry to keep their mempool focused on realistic candidates. A shorter expiry window means less stale data and faster UTXO index lookups. Some operators set -mempoolexpiry=72 (3 days) for performance-sensitive applications.
Spam and Dust Mitigation
During periods of elevated spam or dust transaction activity, expiry acts as a natural cleanup mechanism. Spam transactions typically carry minimal fees and are unlikely to confirm, so they are cleared out within the expiry window without manual intervention.
Risks and Considerations
Silent Transaction Failure
Many users assume that a broadcast transaction will eventually confirm or visibly fail. Mempool expiry creates a third outcome: the transaction quietly disappears. Wallets that do not monitor for expiry or automatically rebroadcast may leave users believing a payment is pending when it no longer exists in any mempool. This is a common source of confusion for merchants and exchanges processing unconfirmed transactions.
Inconsistent Expiry Across Nodes
Because expiry is a local policy, different nodes may drop the same transaction at different times. A transaction might expire on most nodes but survive on a miner's node with a longer expiry setting. This means an "expired" transaction could still confirm unexpectedly if a miner includes it in a block. Users who create a replacement transaction after assumed expiry risk a double-spend scenario if the original confirms first. The safest approach is to always use RBF to replace transactions rather than relying on expiry.
Group Expiry Semantics
Bitcoin Core currently bases expiry on when a transaction first entered the mempool, not on the most recent activity in its dependency chain. A parent transaction submitted 13 days ago with a child submitted 1 hour ago will see the parent expire (and the child evicted with it) after day 14. Bitcoin developers have discussed proposals to base expiry on the most recent transaction in a group, but no consensus change has been merged as of late 2026.
Interaction with Fee Estimation
Fee estimation algorithms use mempool state to predict confirmation times. When a large batch of transactions expires simultaneously, the mempool shrinks and fee estimates may drop. This can create a brief window where new transactions underpay relative to actual mining demand, especially if the expired transactions are rebroadcast shortly after. For a deeper look at how fee dynamics work, see the fee market dynamics analysis.
This glossary entry is for informational purposes only and does not constitute financial or investment advice. Always do your own research before using any protocol or technology.