| 2162 | } |
| 2163 | |
| 2164 | void 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 | |
| 2185 | void UpdateCoins(const CTransaction& tx, CValidationState& state, CCoinsViewCache& inputs, CTxUndo& txundo, int nHeight) |
| 2186 | { |
no test coverage detected