Browse Source

Fix comparison tool by asking for blocks more aggressively

Rebased-from: b33b9a6fef
0.8
Matt Corallo 11 years ago committed by Warren Togami
parent
commit
8ede0c3460
  1. 4
      src/main.cpp
  2. 7
      src/main.h

4
src/main.cpp

@ -2131,7 +2131,7 @@ bool CBlock::CheckBlock(CValidationState &state, bool fCheckPOW, bool fCheckMerk
uniqueTx.insert(GetTxHash(i)); uniqueTx.insert(GetTxHash(i));
} }
if (uniqueTx.size() != vtx.size()) if (uniqueTx.size() != vtx.size())
return state.DoS(100, error("CheckBlock() : duplicate transaction")); return state.DoS(100, error("CheckBlock() : duplicate transaction"), true);
unsigned int nSigOps = 0; unsigned int nSigOps = 0;
BOOST_FOREACH(const CTransaction& tx, vtx) BOOST_FOREACH(const CTransaction& tx, vtx)
@ -3630,7 +3630,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
pfrom->AddInventoryKnown(inv); pfrom->AddInventoryKnown(inv);
CValidationState state; CValidationState state;
if (ProcessBlock(state, pfrom, &block)) if (ProcessBlock(state, pfrom, &block) || state.CorruptionPossible())
mapAlreadyAskedFor.erase(inv); mapAlreadyAskedFor.erase(inv);
int nDoS = 0; int nDoS = 0;
if (state.IsInvalid(nDoS)) if (state.IsInvalid(nDoS))

7
src/main.h

@ -1907,13 +1907,15 @@ private:
MODE_ERROR, // run-time error MODE_ERROR, // run-time error
} mode; } mode;
int nDoS; int nDoS;
bool corruptionPossible;
public: public:
CValidationState() : mode(MODE_VALID), nDoS(0) {} CValidationState() : mode(MODE_VALID), nDoS(0) {}
bool DoS(int level, bool ret = false) { bool DoS(int level, bool ret = false, bool corruptionIn = false) {
if (mode == MODE_ERROR) if (mode == MODE_ERROR)
return ret; return ret;
nDoS += level; nDoS += level;
mode = MODE_INVALID; mode = MODE_INVALID;
corruptionPossible = corruptionIn;
return ret; return ret;
} }
bool Invalid(bool ret = false) { bool Invalid(bool ret = false) {
@ -1943,6 +1945,9 @@ public:
} }
return false; return false;
} }
bool CorruptionPossible() {
return corruptionPossible;
}
}; };

Loading…
Cancel
Save