diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2020-06-13 14:20:20 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2020-07-08 22:31:51 +0000 |
commit | 0fd6ccef2164f8a40988df16d37175a16ed27128 (patch) | |
tree | a5e5a7ccdb6a219bfed238c15896c51e76fd150e /cmake/test-libusb-version.c | |
parent | Merge pull request #6675 (diff) | |
download | monero-0fd6ccef2164f8a40988df16d37175a16ed27128.tar.xz |
blockchain: fix timestamp/difficulty cache getting out of sync
The cache is discarded when a block is popped, but then gets
rebuilt when the difficulty for next block is requested.
While this is all properly locked, it does not take into account
the delay caused by a database transaction being only committed
(and thus its effects made visible to other threads) later on,
which means another thread could request difficulty between
the pop and the commit, which would end up using stale database
view to build the cache, but that cache would not be invalidated
again when the transaction gets committed, which would cause the
cache to not match the new database data.
To fix this, we now keep track of when the cache is invalidated
so we can invalidate it again upon database transaction commit
to ensure it gets calculated again with fresh data next time it
is nedeed.
Diffstat (limited to 'cmake/test-libusb-version.c')
0 files changed, 0 insertions, 0 deletions