Blockstream / Blockstream/esplora
`indexed_headers` should be locked during the whole process of `stats` function
- Dominant language
- JavaScript
- Stars
- 1.3k
- Forks
- 514
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 16
Description
In the function `stats` in `schema.rs`, `indexed_headers` is used both in checking the validity of the cache (in `height_by_hash`) and updating the stats (in `stats_delta->tx_confirming_block`).
We should keep `indexed_headers` locked during the whole process of `stats`. Otherwise, `indexed_headers` can be changed inside the `stats` function, which will lead to the cache and updated stats being build based on different blockchains.
Although the probability is really low for `indexed_headers` to be changed during the running of the `stats` function, it will also happen, especially for address with a lot of transactions whose `stats_delta` will last a long time.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.