|
23 | 23 | #include <hash.h> |
24 | 24 | #include <kernel/chainparams.h> |
25 | 25 | #include <kernel/mempool_entry.h> |
| 26 | +#include <kernel/notifications_interface.h> |
26 | 27 | #include <logging.h> |
27 | 28 | #include <logging/timer.h> |
28 | 29 | #include <node/blockstorage.h> |
@@ -72,6 +73,7 @@ using kernel::CCoinsStats; |
72 | 73 | using kernel::CoinStatsHashType; |
73 | 74 | using kernel::ComputeUTXOStats; |
74 | 75 | using kernel::LoadMempool; |
| 76 | +using kernel::Notifications; |
75 | 77 |
|
76 | 78 | using fsbridge::FopenFn; |
77 | 79 | using node::BlockManager; |
@@ -4145,14 +4147,15 @@ bool Chainstate::LoadChainTip() |
4145 | 4147 | return true; |
4146 | 4148 | } |
4147 | 4149 |
|
4148 | | -CVerifyDB::CVerifyDB() |
| 4150 | +CVerifyDB::CVerifyDB(Notifications& notifications) |
| 4151 | + : m_notifications{notifications} |
4149 | 4152 | { |
4150 | | - uiInterface.ShowProgress(_("Verifying blocks…").translated, 0, false); |
| 4153 | + m_notifications.progress(_("Verifying blocks…"), 0, false); |
4151 | 4154 | } |
4152 | 4155 |
|
4153 | 4156 | CVerifyDB::~CVerifyDB() |
4154 | 4157 | { |
4155 | | - uiInterface.ShowProgress("", 100, false); |
| 4158 | + m_notifications.progress(bilingual_str{}, 100, false); |
4156 | 4159 | } |
4157 | 4160 |
|
4158 | 4161 | VerifyDBResult CVerifyDB::VerifyDB( |
@@ -4192,7 +4195,7 @@ VerifyDBResult CVerifyDB::VerifyDB( |
4192 | 4195 | LogPrintf("Verification progress: %d%%\n", percentageDone); |
4193 | 4196 | reportDone = percentageDone / 10; |
4194 | 4197 | } |
4195 | | - uiInterface.ShowProgress(_("Verifying blocks…").translated, percentageDone, false); |
| 4198 | + m_notifications.progress(_("Verifying blocks…"), percentageDone, false); |
4196 | 4199 | if (pindex->nHeight <= chainstate.m_chain.Height() - nCheckDepth) { |
4197 | 4200 | break; |
4198 | 4201 | } |
@@ -4268,7 +4271,7 @@ VerifyDBResult CVerifyDB::VerifyDB( |
4268 | 4271 | LogPrintf("Verification progress: %d%%\n", percentageDone); |
4269 | 4272 | reportDone = percentageDone / 10; |
4270 | 4273 | } |
4271 | | - uiInterface.ShowProgress(_("Verifying blocks…").translated, percentageDone, false); |
| 4274 | + m_notifications.progress(_("Verifying blocks…"), percentageDone, false); |
4272 | 4275 | pindex = chainstate.m_chain.Next(pindex); |
4273 | 4276 | CBlock block; |
4274 | 4277 | if (!chainstate.m_blockman.ReadBlockFromDisk(block, *pindex)) { |
@@ -4327,7 +4330,7 @@ bool Chainstate::ReplayBlocks() |
4327 | 4330 | if (hashHeads.empty()) return true; // We're already in a consistent state. |
4328 | 4331 | if (hashHeads.size() != 2) return error("ReplayBlocks(): unknown inconsistent state"); |
4329 | 4332 |
|
4330 | | - uiInterface.ShowProgress(_("Replaying blocks…").translated, 0, false); |
| 4333 | + m_chainman.GetNotifications().progress(_("Replaying blocks…"), 0, false); |
4331 | 4334 | LogPrintf("Replaying blocks\n"); |
4332 | 4335 |
|
4333 | 4336 | const CBlockIndex* pindexOld = nullptr; // Old tip during the interrupted flush. |
@@ -4374,13 +4377,13 @@ bool Chainstate::ReplayBlocks() |
4374 | 4377 | const CBlockIndex& pindex{*Assert(pindexNew->GetAncestor(nHeight))}; |
4375 | 4378 |
|
4376 | 4379 | LogPrintf("Rolling forward %s (%i)\n", pindex.GetBlockHash().ToString(), nHeight); |
4377 | | - uiInterface.ShowProgress(_("Replaying blocks…").translated, (int) ((nHeight - nForkHeight) * 100.0 / (pindexNew->nHeight - nForkHeight)) , false); |
| 4380 | + m_chainman.GetNotifications().progress(_("Replaying blocks…"), (int)((nHeight - nForkHeight) * 100.0 / (pindexNew->nHeight - nForkHeight)), false); |
4378 | 4381 | if (!RollforwardBlock(&pindex, cache)) return false; |
4379 | 4382 | } |
4380 | 4383 |
|
4381 | 4384 | cache.SetBestBlock(pindexNew->GetBlockHash()); |
4382 | 4385 | cache.Flush(); |
4383 | | - uiInterface.ShowProgress("", 100, false); |
| 4386 | + m_chainman.GetNotifications().progress(bilingual_str{}, 100, false); |
4384 | 4387 | return true; |
4385 | 4388 | } |
4386 | 4389 |
|
|
0 commit comments