HomePhabricator

[Chronik] Add `-chroniktokenindex=0` to disable the token index

Description

[Chronik] Add -chroniktokenindex=0 to disable the token index

Summary:
Currently, the SLP/ALP index is on by default, but some users may be uninterested in this, and be forced to waste compute/disk space.

With this change, they can specify -chroniktokenindex=0 to disable the token index.

The DB stores what the last setting was, and disallows -chroniktokenindex=1 on a DB that didn't previously have token data. This is important because we can't build a token index in the middle of the blockchain, we need to start at the first GENESIS tx.

If the DB previously had token data and the user disables the token index, we wipe it to save space. It would be useless anyway once a block gets connected. In theory, we could mark the token index to be wiped and only wipe once a block connects so the user could save their index in time, but this should probably be added once people might actually need it.

-chroniktokenindex=1 is set to be the default, because it is very easy to wipe the token data if the index has been enabled erroneously, so there's little harm.

However, if it were not the default and someone needs the token index and they forget to specify -chroniktokenindex=1, the DB is either useless and needs a reindex, or worse it might wipe the existing token index, which does not spark joy.

Test Plan: ninja check-functional

Reviewers: Fabien, #bitcoin_abc

Reviewed By: Fabien, #bitcoin_abc

Differential Revision: https://reviews.bitcoinabc.org/D15438

Details

Provenance
tobias_ruckAuthored on Feb 13 2024, 11:33
tobias_ruckPushed on Feb 13 2024, 17:34
Reviewer
Restricted Project
Differential Revision
D15438: [Chronik] Add `-chroniktokenindex=0` to disable the token index
Parents
rABC2fdb90d0bd52: [Cashtab] Bump timeout for jest tests
Branches
Unknown
Tags
Unknown