MCPcopy Create free account
hub / github.com/LUX-Core/lux / InvalidBlockFound

Function InvalidBlockFound

src/main.cpp:2164–2183  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2162}
2163
2164void static InvalidBlockFound(CBlockIndex* pindex, const CValidationState& state)
2165{
2166 int nDoS = 0;
2167 if (state.IsInvalid(nDoS)) {
2168 std::map<uint256, NodeId>::iterator it = mapBlockSource.find(pindex->GetBlockHash());
2169 if (it != mapBlockSource.end() && State(it->second)) {
2170 assert (state.GetRejectCode() < REJECT_INTERNAL); // Blocks are never rejected with internal reject codes
2171 CBlockReject reject = {static_cast<unsigned char>(state.GetRejectCode()), state.GetRejectReason().substr(0, MAX_REJECT_MESSAGE_LENGTH), pindex->GetBlockHash()};
2172 State(it->second)->rejects.push_back(reject);
2173 if (nDoS > 0)
2174 Misbehaving(it->second, nDoS);
2175 }
2176 }
2177 if (!state.CorruptionPossible()) {
2178 pindex->nStatus |= BLOCK_FAILED_VALID;
2179 setDirtyBlockIndex.insert(pindex);
2180 setBlockIndexCandidates.erase(pindex);
2181 InvalidChainFound(pindex);
2182 }
2183}
2184
2185void UpdateCoins(const CTransaction& tx, CValidationState& state, CCoinsViewCache& inputs, CTxUndo& txundo, int nHeight)
2186{

Callers 1

ConnectTipFunction · 0.85

Calls 13

MisbehavingFunction · 0.85
InvalidChainFoundFunction · 0.85
IsInvalidMethod · 0.80
GetRejectCodeMethod · 0.80
GetRejectReasonMethod · 0.80
CorruptionPossibleMethod · 0.80
StateFunction · 0.70
findMethod · 0.45
GetBlockHashMethod · 0.45
endMethod · 0.45
push_backMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected