Merge 04265ba937 into merged_master (Bitcoin PR bitcoin/bitcoin#26331)

This commit is contained in:
Byron Hambly 2025-08-06 20:35:14 +02:00
commit d9e1e28421
No known key found for this signature in database
GPG key ID: DE8F6EA20A661697
3 changed files with 23 additions and 3 deletions

View file

@ -1275,6 +1275,15 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
RandAddPeriodic();
}, std::chrono::minutes{1});
// Check disk space every 5 minutes to avoid db corruption.
node.scheduler->scheduleEvery([&args]{
constexpr uint64_t min_disk_space = 50 << 20; // 50 MB
if (!CheckDiskSpace(args.GetBlocksDirPath(), min_disk_space)) {
LogPrintf("Shutting down due to lack of disk space!\n");
StartShutdown();
}
}, std::chrono::minutes{5});
GetMainSignals().RegisterBackgroundSignalScheduler(*node.scheduler);
// Create client interfaces for wallets that are supposed to be loaded