Add assertion and cast before sending reject code
This gets rid of a warning. Add an assertion to make sure that the reject code is in the correct range for the network protocol (if it is outside the range it must be a bug)
This commit is contained in:
parent
a651403e09
commit
5922b6774e
1 changed files with 2 additions and 1 deletions
|
@ -1343,7 +1343,8 @@ void static InvalidBlockFound(CBlockIndex *pindex, const CValidationState &state
|
|||
if (state.IsInvalid(nDoS)) {
|
||||
std::map<uint256, NodeId>::iterator it = mapBlockSource.find(pindex->GetBlockHash());
|
||||
if (it != mapBlockSource.end() && State(it->second)) {
|
||||
CBlockReject reject = {state.GetRejectCode(), state.GetRejectReason().substr(0, MAX_REJECT_MESSAGE_LENGTH), pindex->GetBlockHash()};
|
||||
assert(state.GetRejectCode() < 0x100);
|
||||
CBlockReject reject = {(unsigned char)state.GetRejectCode(), state.GetRejectReason().substr(0, MAX_REJECT_MESSAGE_LENGTH), pindex->GetBlockHash()};
|
||||
State(it->second)->rejects.push_back(reject);
|
||||
if (nDoS > 0)
|
||||
Misbehaving(it->second, nDoS);
|
||||
|
|
Loading…
Reference in a new issue