diff options
| author | Wladimir J. van der Laan <[email protected]> | 2018-04-23 14:31:47 +0200 |
|---|---|---|
| committer | Wladimir J. van der Laan <[email protected]> | 2018-04-23 14:37:45 +0200 |
| commit | 4741ca5dc8fd364352ebae3ba9bfb701f1847d26 (patch) | |
| tree | 10805762aad32df1065ee301081a59200820985e /src/net_processing.cpp | |
| parent | Merge #13039: Add logging and error handling for file syncing (diff) | |
| parent | Consistently log CValidationState on failure (diff) | |
| download | discoin-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.cpp | 12 |
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); |