aboutsummaryrefslogtreecommitdiff
path: root/src/net_processing.cpp
diff options
context:
space:
mode:
authorBen Woosley <ben.woosley@gmail.com>2018-04-18 09:58:13 -0400
committerBen Woosley <ben.woosley@gmail.com>2018-04-18 18:43:12 -0400
commite4d0b44373c75a597c21a0e93698364fc33fb79d (patch)
tree0c952fb20dbe102e0014617af79e453c6d4f6587 /src/net_processing.cpp
parent615f7c288414a89cd1dec1d67e0f84abe2fb4c6d (diff)
Consistently log CValidationState on failure
Seems providing at least minimal visibility to the failure is a good practice. The only remaining ignored state is in LoadExternalBlockFile, where logging would likely be spammy.
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 dbdae705de..ee4e9e61bc 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);