Page MenuHomePhabricator

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

Authored by tobias_ruck on Feb 13 2024, 11:34.

Details

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

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

tobias_ruck edited the summary of this revision. (Show Details)

fix comments, update error message

This revision is now accepted and ready to land.Feb 13 2024, 15:19

forgot to use the burn TokenTx, put to use now

The build failed due to an unexpected infrastructure outage. The administrators have been notified to investigate. Sorry for the inconvenience.

The failure is unrelated, but I still need to figure out why the .lock file is not removed when a test fails while chronik is in use