mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-21 07:39:08 +01:00
Fix comparison tool by asking for blocks more aggressively
Rebased-from: b33b9a6fef
This commit is contained in:
committed by
Wladimir J. van der Laan
parent
7084756f4f
commit
5c55bf5af0
@@ -2123,7 +2123,7 @@ bool CBlock::CheckBlock(CValidationState &state, bool fCheckPOW, bool fCheckMerk
|
||||
uniqueTx.insert(GetTxHash(i));
|
||||
}
|
||||
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;
|
||||
BOOST_FOREACH(const CTransaction& tx, vtx)
|
||||
@@ -3583,7 +3583,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
|
||||
pfrom->AddInventoryKnown(inv);
|
||||
|
||||
CValidationState state;
|
||||
if (ProcessBlock(state, pfrom, &block))
|
||||
if (ProcessBlock(state, pfrom, &block) || state.CorruptionPossible())
|
||||
mapAlreadyAskedFor.erase(inv);
|
||||
int nDoS;
|
||||
if (state.IsInvalid(nDoS))
|
||||
|
||||
@@ -1881,13 +1881,15 @@ private:
|
||||
MODE_ERROR, // run-time error
|
||||
} mode;
|
||||
int nDoS;
|
||||
bool corruptionPossible;
|
||||
public:
|
||||
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)
|
||||
return ret;
|
||||
nDoS += level;
|
||||
mode = MODE_INVALID;
|
||||
corruptionPossible = corruptionIn;
|
||||
return ret;
|
||||
}
|
||||
bool Invalid(bool ret = false) {
|
||||
@@ -1917,6 +1919,9 @@ public:
|
||||
}
|
||||
return false;
|
||||
}
|
||||
bool CorruptionPossible() {
|
||||
return corruptionPossible;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user