Glossary

Ancestor Set

An ancestor set is the group of unconfirmed parent transactions that must be included before a given mempool transaction.

Key Takeaways

  • An ancestor set includes every unconfirmed transaction in a given transaction's dependency chain: its parents, grandparents, and so on through the mempool. All ancestors must be confirmed before the transaction itself can be included in a block.
  • Miners evaluate the ancestor feerate (total fees divided by total virtual size of the ancestor package) to determine mining priority. This is how child-pays-for-parent (CPFP) works.
  • Bitcoin Core enforces default ancestor limits of 25 transactions and 101 kvB total size. The cluster mempool redesign in v31.0 replaces these per-transaction limits with cluster-level constraints.

What Is an Ancestor Set?

An ancestor set is the complete group of unconfirmed transactions that a given mempool transaction depends on. Because Bitcoin transactions spend outputs from previous transactions, a transaction cannot be valid in a block unless every transaction it spends from has already been confirmed or appears earlier in the same block. The ancestor set captures this full chain of dependencies.

Consider a simple example: transaction C spends an output from transaction B, which in turn spends an output from transaction A. If all three are unconfirmed in the mempool, then the ancestor set of transaction C consists of both A and B. A miner who wants to include C in a block must also include A and B, in that order. The ancestor set defines the minimum package of transactions that must travel together.

This concept is fundamental to how Bitcoin Core selects transactions for block templates, how fee bumping strategies work, and how the mempool enforces policy limits to prevent denial-of-service attacks.

How It Works

When a new transaction enters the mempool, Bitcoin Core traces its inputs to identify any unconfirmed transactions it depends on. Those dependencies, plus their own dependencies, form the ancestor set. The node then computes two critical metrics for the transaction:

  1. Ancestor count: the total number of unconfirmed ancestors, including the transaction itself
  2. Ancestor size: the combined virtual size of all ancestors, including the transaction itself

These values determine whether the transaction is accepted into the mempool and how it is prioritized for mining.

Ancestor Feerate and Mining Priority

Bitcoin Core's block template algorithm uses ancestor feerate to decide which transactions to include. The ancestor feerate is calculated as:

ancestor_feerate = (tx_fee + sum_of_ancestor_fees) / (tx_vsize + sum_of_ancestor_vsizes)

The algorithm repeatedly selects the transaction with the highest ancestor feerate, includes it and its ancestors in the block, then recalculates the remaining transactions' ancestor feerates. This greedy approach approximates optimal fee revenue for miners.

This is the mechanism that makes CPFP possible. A low-fee parent transaction stuck in the mempool can be "pulled along" by a high-fee child. The child's high fee raises the ancestor feerate of the entire package, making it attractive for miners to include both transactions. For a detailed walkthrough, see the fee bumping guide.

Querying Ancestor Data

Bitcoin Core exposes ancestor information through the getmempoolancestors RPC. In verbose mode, it returns detailed statistics for each ancestor:

# List all in-mempool ancestors of a transaction
bitcoin-cli getmempoolancestors <txid>

# Verbose output with fee and size details
bitcoin-cli getmempoolancestors <txid> true

# Example verbose output per ancestor:
{
  "size": 225,
  "vsize": 141,
  "weight": 561,
  "fee": 0.00001410,
  "ancestorcount": 2,
  "ancestorsize": 282,
  "ancestorfees": 4230,
  "depends": ["parent_txid_here"],
  "spentby": ["child_txid_here"]
}

The ancestorcount and ancestorsize fields include the transaction itself, so a transaction with no unconfirmed parents will show an ancestor count of 1. The depends array lists the direct parent transactions within the mempool.

Default Ancestor Limits

To prevent resource exhaustion and denial-of-service attacks, Bitcoin Core enforces policy limits on ancestor sets. Prior to v31.0, the defaults were:

ParameterDefaultConfig Flag
Max ancestor count25 transactions-limitancestorcount
Max ancestor size101 kvB-limitancestorsize
Max descendant count25 transactions-limitdescendantcount
Max descendant size101 kvB-limitdescendantsize

Transactions that would cause any of these limits to be exceeded are rejected with the error too-long-mempool-chain. These limits are policy rules, not consensus rules: miners can include transactions that violate them, but most nodes will not relay them.

Cluster Mempool and the Future of Ancestor Tracking

The traditional ancestor/descendant tracking model has a fundamental limitation: Bitcoin Core used ancestor feerate for mining (block construction) but descendant feerate for eviction (mempool trimming). This asymmetry meant that transactions evicted from the mempool were not always the ones least likely to be mined, leading to suboptimal behavior during congestion.

The cluster mempool redesign, developed primarily by Pieter Wuille and Suhas Daftuar and shipped in Bitcoin Core v31.0, replaces this dual-metric system. Instead of tracking ancestors and descendants separately for each transaction, the new design groups all related transactions into clusters: sets of transactions connected by parent-child spending relationships.

Each cluster is linearized (sorted by feerate into chunks), and the same ordering is used for both mining and eviction. The old per-transaction ancestor and descendant limits are replaced by per-cluster limits: a default maximum of 64 transactions and 101 kvB per cluster. For a detailed explanation, see the cluster mempool deep dive.

Use Cases

Fee Bumping with CPFP

The most common practical use of ancestor sets is CPFP fee bumping. When a transaction is stuck with a low fee rate, the sender or receiver can create a child transaction spending one of its outputs with a high fee. This raises the ancestor feerate of the child's package, incentivizing miners to confirm both transactions.

Wallets and Lightning implementations use this technique routinely. Lightning anchor channels, for example, rely on CPFP to adjust the fee on commitment transactions after broadcast. The effectiveness of CPFP depends directly on the ancestor set: the more low-fee ancestors in the chain, the more fee the child must pay to raise the package's overall rate.

Transaction Package Evaluation

Package relay, a feature under active development for Bitcoin Core, allows nodes to evaluate groups of related transactions together rather than individually. This is essential for protocols like Lightning, where a commitment transaction may have a fee rate below the minimum relay fee but is paired with a high-fee child. Understanding ancestor sets is the foundation for package relay and package CPFP.

Mempool Monitoring and Fee Estimation

Block explorers and fee estimation tools analyze ancestor sets to predict confirmation times. A transaction's effective priority is not its individual feerate but its ancestor feerate, so accurate fee estimates must account for the entire dependency chain. Services like mempool.space display effective feerates rather than nominal ones for this reason.

Risks and Considerations

Chain Length Limits

The 25-ancestor limit (pre-v31) can block legitimate use cases. Protocols that create long chains of unconfirmed transactions, such as batch payouts or channel factories, may hit this ceiling. The one-parent-one-child (1p1c) relay policy was introduced in part to ensure that at least simple CPFP bumps always work, even when the mempool is under pressure.

Pinning Attacks

Transaction pinning exploits ancestor and descendant limits to prevent legitimate fee bumps. An attacker can create many low-fee descendants of a target transaction, filling the descendant limit and blocking the victim from adding a high-fee CPFP child. This is particularly concerning for time-sensitive protocols like Lightning, where delayed confirmation of a commitment transaction can lead to fund loss.

Mitigations include ephemeral anchors, TRUC (v3) transactions, and the cluster mempool redesign, which replaces the old limit framework with more flexible constraints. For a deeper analysis of pinning attacks and their mitigations, see the transaction pinning research article.

Computational Overhead

Maintaining accurate ancestor and descendant data for every mempool transaction is computationally expensive. Each time a transaction enters or leaves the mempool, the node must update the ancestor and descendant counts and sizes for all affected transactions. This was one of the motivations for the cluster mempool redesign, which tracks these relationships at the cluster level rather than the individual transaction level.

Why It Matters

Ancestor sets are central to how Bitcoin processes transactions. They determine mining priority, govern fee bumping strategies, and shape mempool policy. Any wallet, exchange, or protocol that constructs Bitcoin transactions must account for ancestor set dynamics: a transaction's confirmation time depends not just on its own fee but on the fees and sizes of its entire unconfirmed ancestry.

For Layer 2 protocols like Lightning and Spark, ancestor set behavior is especially important. These protocols rely on timely confirmation of on-chain transactions (commitment transactions, penalty transactions, cooperative closes) and use CPFP as a primary fee bumping mechanism. Understanding ancestor limits and feerate calculations is essential for building reliable off-chain systems on top of Bitcoin.

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.