<p>The block filter index is build asynchronously from block downloading and validation. It is possible that the thread handing block storage and pruning could be enough ahead of the thread building the block filter index that it starts to delete blocks before the index thread processes them. This would be bad. So for the initial block filter index implementation, it was decided to simply disallow pruning when the block filter index is enabled. You can read some of the reasoning and discussion <a href="https://github.com/bitcoin/bitcoin/pull/14121#discussion_r274962598" rel="noreferrer">in the PR</a>.</p>
<p>In theory it is possible to allow pruning with the block filter index. However it is more work to do this and at least for the initial implementation, the extra code wasn't worth it. PR authors often do this to keep the PR small enough to be reviewed. This functionality could be added in the future as it is part of the more general problem of how we should handle pruning with the wallet and with the txindex.</p>

CC BY-SA 4.0
2020-11-22T21:23:55.333Z
2020-11-22T21:23:55.333Z
Ava Chow
<p>I run a node in pruned mode. I want to enable <code>blockfilterindex</code>. What I expected the node to do was:</p>
<ol>
<li>start downloading blocks from the very beginning;</li>
<li>create the block filter as it goes through the blocks;</li>
<li>only keep the last N MB of blocks stored.</li>
</ol>
<p>What really happened was:</p>
<pre><code>$ bitcoind -blockfilterindex -prune=550
Error: Prune mode is incompatible with -txindex.
</code></pre>
<p>I understand that it is not possible to enable block filtering without <em>downloading</em> all blocks, but why does it require <em>storing</em> all the blocks?</p>

CC BY-SA 4.0
2020-11-22T19:42:07.963Z
That error isn't for `-blockfilterindex`, it's for `-txindex`. Do you have `txindex=1` in your bitcoin.conf file?
Ava Chow
CC BY-SA 4.0
2020-11-22T20:16:45.510Z
True! However, when I disabled `txindex`, I got `Error: Prune mode is incompatible with -blockfilterindex.`
Sergei Tikhomirov
<pruning><reindex><txindex>
Can I use blockfilterindex in pruned mode?
Sergei Tikhomirov
# Can I use blockfilterindex in pruned mode?

(Asked by: username_0 on 2020-11-22)

I run a node in pruned mode. I want to enable `blockfilterindex`. What I expected the node to do was:

1. start downloading blocks from the very beginning;
2. create the block filter as it goes through the blocks;
3. only keep the last N MB of blocks stored.

What really happened was:

```
$ bitcoind -blockfilterindex -prune=550
Error: Prune mode is incompatible with -txindex.

```

I understand that it is not possible to enable block filtering without *downloading* all blocks, but why does it require *storing* all the blocks?

**Tags:** pruning, reindex, txindex

> **Comments:**
> **username_1**: That error isn't for `-blockfilterindex`, it's for `-txindex`. Do you have `txindex=1` in your bitcoin.conf file?  
> **username_0**: True! However, when I disabled `txindex`, I got `Error: Prune mode is incompatible with -blockfilterindex.`  

---

## 1 answers

### Answer by username_1 on 2020-11-22. Score: 5 | Accepted answer

The block filter index is build asynchronously from block downloading and validation. It is possible that the thread handing block storage and pruning could be enough ahead of the thread building the block filter index that it starts to delete blocks before the index thread processes them. This would be bad. So for the initial block filter index implementation, it was decided to simply disallow pruning when the block filter index is enabled. You can read some of the reasoning and discussion [in the PR](https://github.com/bitcoin/bitcoin/pull/14121#discussion_r274962598).

In theory it is possible to allow pruning with the block filter index. However it is more work to do this and at least for the initial implementation, the extra code wasn't worth it. PR authors often do this to keep the PR small enough to be reviewed. This functionality could be added in the future as it is part of the more general problem of how we should handle pruning with the wallet and with the txindex.


---

