@@ -1865,39 +1865,45 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
1865
1865
1866
1866
uiInterface.InitMessage (_ (" Loading block index…" ).translated );
1867
1867
const auto load_block_index_start_time{SteadyClock::now ()};
1868
- auto rv = LoadChainstate (fReset ,
1869
- chainman,
1870
- *node.govman ,
1871
- *node.mn_metaman ,
1872
- *node.mn_sync ,
1873
- *node.sporkman ,
1874
- node.mn_activeman ,
1875
- node.chain_helper ,
1876
- node.cpoolman ,
1877
- node.dmnman ,
1878
- node.evodb ,
1879
- node.mnhf_manager ,
1880
- llmq::chainLocksHandler,
1881
- llmq::quorumInstantSendManager,
1882
- llmq::quorumSnapshotManager,
1883
- node.llmq_ctx ,
1884
- Assert (node.mempool .get ()),
1885
- fPruneMode ,
1886
- args.GetBoolArg (" -addressindex" , DEFAULT_ADDRESSINDEX),
1887
- is_governance_enabled,
1888
- args.GetBoolArg (" -spentindex" , DEFAULT_SPENTINDEX),
1889
- args.GetBoolArg (" -timestampindex" , DEFAULT_TIMESTAMPINDEX),
1890
- args.GetBoolArg (" -txindex" , DEFAULT_TXINDEX),
1891
- chainparams,
1892
- fReindexChainState ,
1893
- nBlockTreeDBCache,
1894
- nCoinDBCache,
1895
- nCoinCacheUsage,
1896
- []() {
1897
- uiInterface.ThreadSafeMessageBox (
1898
- _ (" Error reading from database, shutting down." ),
1899
- " " , CClientUIInterface::MSG_ERROR);
1900
- });
1868
+ std::optional<ChainstateLoadingError> rv;
1869
+ try {
1870
+ rv = LoadChainstate (fReset ,
1871
+ chainman,
1872
+ *node.govman ,
1873
+ *node.mn_metaman ,
1874
+ *node.mn_sync ,
1875
+ *node.sporkman ,
1876
+ node.mn_activeman ,
1877
+ node.chain_helper ,
1878
+ node.cpoolman ,
1879
+ node.dmnman ,
1880
+ node.evodb ,
1881
+ node.mnhf_manager ,
1882
+ llmq::chainLocksHandler,
1883
+ llmq::quorumInstantSendManager,
1884
+ llmq::quorumSnapshotManager,
1885
+ node.llmq_ctx ,
1886
+ Assert (node.mempool .get ()),
1887
+ fPruneMode ,
1888
+ args.GetBoolArg (" -addressindex" , DEFAULT_ADDRESSINDEX),
1889
+ is_governance_enabled,
1890
+ args.GetBoolArg (" -spentindex" , DEFAULT_SPENTINDEX),
1891
+ args.GetBoolArg (" -timestampindex" , DEFAULT_TIMESTAMPINDEX),
1892
+ args.GetBoolArg (" -txindex" , DEFAULT_TXINDEX),
1893
+ chainparams,
1894
+ fReindexChainState ,
1895
+ nBlockTreeDBCache,
1896
+ nCoinDBCache,
1897
+ nCoinCacheUsage,
1898
+ []() {
1899
+ uiInterface.ThreadSafeMessageBox (
1900
+ _ (" Error reading from database, shutting down." ),
1901
+ " " , CClientUIInterface::MSG_ERROR);
1902
+ });
1903
+ } catch (const std::exception & e) {
1904
+ LogPrintf (" %s\n " , e.what ());
1905
+ rv = ChainstateLoadingError::ERROR_GENERIC_BLOCKDB_OPEN_FAILED;
1906
+ }
1901
1907
if (rv.has_value ()) {
1902
1908
switch (rv.value ()) {
1903
1909
case ChainstateLoadingError::ERROR_LOADING_BLOCK_DB:
@@ -1951,14 +1957,20 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
1951
1957
break ;
1952
1958
}
1953
1959
} else {
1954
- uiInterface.InitMessage (_ (" Verifying blocks…" ).translated );
1955
- auto rv2 = VerifyLoadedChainstate (chainman,
1956
- *Assert (node.evodb .get ()),
1957
- fReset ,
1958
- fReindexChainState ,
1959
- chainparams,
1960
- args.GetArg (" -checkblocks" , DEFAULT_CHECKBLOCKS),
1961
- args.GetArg (" -checklevel" , DEFAULT_CHECKLEVEL));
1960
+ std::optional<ChainstateLoadVerifyError> rv2;
1961
+ try {
1962
+ uiInterface.InitMessage (_ (" Verifying blocks…" ).translated );
1963
+ rv2 = VerifyLoadedChainstate (chainman,
1964
+ *Assert (node.evodb .get ()),
1965
+ fReset ,
1966
+ fReindexChainState ,
1967
+ chainparams,
1968
+ args.GetArg (" -checkblocks" , DEFAULT_CHECKBLOCKS),
1969
+ args.GetArg (" -checklevel" , DEFAULT_CHECKLEVEL));
1970
+ } catch (const std::exception & e) {
1971
+ LogPrintf (" %s\n " , e.what ());
1972
+ rv2 = ChainstateLoadVerifyError::ERROR_GENERIC_FAILURE;
1973
+ }
1962
1974
if (rv2.has_value ()) {
1963
1975
switch (rv2.value ()) {
1964
1976
case ChainstateLoadVerifyError::ERROR_BLOCK_FROM_FUTURE:
0 commit comments