aboutsummaryrefslogtreecommitdiff
path: root/src/net_processing.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <[email protected]>2018-04-23 14:31:47 +0200
committerWladimir J. van der Laan <[email protected]>2018-04-23 14:37:45 +0200
commit4741ca5dc8fd364352ebae3ba9bfb701f1847d26 (patch)
tree10805762aad32df1065ee301081a59200820985e /src/net_processing.cpp
parentMerge #13039: Add logging and error handling for file syncing (diff)
parentConsistently log CValidationState on failure (diff)
downloaddiscoin-4741ca5dc8fd364352ebae3ba9bfb701f1847d26.tar.xz
discoin-4741ca5dc8fd364352ebae3ba9bfb701f1847d26.zip
Merge #13020: Consistently log CValidationState on call failure
e4d0b44 Consistently log CValidationState on failure (Ben Woosley) Pull request description: This replaces potential silent failures and partial logging with full logging. Seems providing at least minimal visibility to the failure is a good practice. E.g. `FlushStateToDisk` can return a rare but meaningful out of disk space error that would be better to note than leave out. Note many of these are related to `ActivateBestChain` or `FlushStateToDisk`. Only a few cases of ignored state remain, e.g. LoadExternalBlockFile and RelayWalletTransaction, where I expect logging would likely be spammy. Tree-SHA512: fb0e521039e5a5250cd9c82e7a8676423b5e3899d495649c0e71752059d1984e5175f556386ade048f51a7d59f5c8e467df7fe91d746076f97d24c000ccf7891
Diffstat (limited to 'src/net_processing.cpp')
-rw-r--r--src/net_processing.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/net_processing.cpp b/src/net_processing.cpp
index dbdae705d..ee4e9e61b 100644
--- a/src/net_processing.cpp
+++ b/src/net_processing.cpp
@@ -1100,8 +1100,10 @@ void static ProcessGetBlockData(CNode* pfrom, const Consensus::Params& consensus
}
} // release cs_main before calling ActivateBestChain
if (need_activate_chain) {
- CValidationState dummy;
- ActivateBestChain(dummy, Params(), a_recent_block);
+ CValidationState state;
+ if (!ActivateBestChain(state, Params(), a_recent_block)) {
+ LogPrint(BCLog::NET, "failed to activate chain (%s)\n", FormatStateMessage(state));
+ }
}
LOCK(cs_main);
@@ -1992,8 +1994,10 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
LOCK(cs_most_recent_block);
a_recent_block = most_recent_block;
}
- CValidationState dummy;
- ActivateBestChain(dummy, Params(), a_recent_block);
+ CValidationState state;
+ if (!ActivateBestChain(state, Params(), a_recent_block)) {
+ LogPrint(BCLog::NET, "failed to activate chain (%s)\n", FormatStateMessage(state));
+ }
}
LOCK(cs_main);