Page MenuHomePhabricator

[Chronik] Add tx num cache
DraftPublic

Authored by tobias_ruck on Feb 16 2024, 12:44.
This is a draft revision that has not yet been submitted for review.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Summary

Previously, we tried using a LRU cache for the number of txs of a script. However, this actually slowed down indexing as opposed to speeding it up.

The reason for this is that the cache wasn't very helpful, because the majority of scripts would yield a cache miss, as the common case is for a script to be seen for the
first time.

We fixed this by using a bloom filter, so now, if the bloom filter returns a hit, we know with relatively high confidence that the script will have a tx history.

Currently we check the DB to get the num txs, but now we can use a LRU cache again, which will have a high chance of resulting in a cache hit.

Depends on D15465.

Test Plan

ninja check-functional