diff options
author | Andrew Chow <github@achow101.com> | 2023-10-09 14:36:12 -0400 |
---|---|---|
committer | Andrew Chow <github@achow101.com> | 2023-10-09 14:52:00 -0400 |
commit | 04265ba9378efbd4c35b33390b1e5cf246d420a9 (patch) | |
tree | c3833e67ff38b276d7fdc46591c8600160ed683b /src/coins.h | |
parent | 4e7442e743afef4d365fc3ce7c6e9f0a5d4d1ec4 (diff) | |
parent | ed52e71176fc97c6ed01e3eebd85acdec54b4448 (diff) |
Merge bitcoin/bitcoin#26331: Implement `CCoinsViewErrorCatcher::HaveCoin` and check disk space periodically
ed52e71176fc97c6ed01e3eebd85acdec54b4448 Periodically check disk space to avoid corruption (Aurèle Oulès)
7fe537f7a48675b1d25542bee6f390d665547580 Implement CCoinsViewErrorCatcher::HaveCoin (Aurèle Oulès)
Pull request description:
Attempt to fix #26112.
As suggested by sipa in https://github.com/bitcoin/bitcoin/issues/26112#issuecomment-1249683401:
> CCoinsViewErrorCatcher, the wrapper class used around CCoinsViewDB that's supposed to detect these problems and forcefully exit the application, has an override for GetCoins. But in CheckTxInputs, HaveInputs is first invoked, which on its turn calls HaveCoin. HaveCoin is implemented in CCoinsViewDB, but not in CCoinsViewErrorCatcher, and thus the disk read exception escapes.
> A solution may be to just add an override for HaveCoin in CCoinsViewErrorCatcher.
I implemented `CCoinsViewErrorCatcher::HaveCoin` and also added a periodic disk space check that shutdowns the node if there is not enough space left on disk, the minimum here is 50MB.
For reviewers, it's possible to saturate disk space to test the PR by creating large files with `fallocate -l 50G test.bin`
ACKs for top commit:
achow101:
ACK ed52e71176fc97c6ed01e3eebd85acdec54b4448
w0xlt:
Code Review ACK https://github.com/bitcoin/bitcoin/pull/26331/commits/ed52e71176fc97c6ed01e3eebd85acdec54b4448
sipa:
utACK ed52e71176fc97c6ed01e3eebd85acdec54b4448
Tree-SHA512: 456aa7b996023df42b4fbb5158ee429d9abf7374b7b1ec129b21aea1188ad19be8da4ae8e0edd90b85b7a3042b8e44e17d3742e33808a4234d5ddbe9bcef1b78
Diffstat (limited to 'src/coins.h')
-rw-r--r-- | src/coins.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/coins.h b/src/coins.h index 039a07054d..a6cbb03133 100644 --- a/src/coins.h +++ b/src/coins.h @@ -383,6 +383,7 @@ public: } bool GetCoin(const COutPoint &outpoint, Coin &coin) const override; + bool HaveCoin(const COutPoint &outpoint) const override; private: /** A list of callbacks to execute upon leveldb read error. */ |