Invoke CheckSpecialTx after all normal TX checks have passed (#2673)

Otherwise duplicate-keys checks for deterministic masternodes triggers
for duplicate/identical transactions.
This commit is contained in:
Alexander Block 2019-02-01 08:49:18 +01:00
parent 592210dafc
commit 0d8cc0761c

View File

@ -656,9 +656,6 @@ bool AcceptToMemoryPoolWorker(CTxMemPool& pool, CValidationState& state, const C
return state.DoS(100, false, REJECT_INVALID, "qc-not-allowed");
}
if (!CheckSpecialTx(tx, chainActive.Tip(), state))
return false;
// Coinbase is only valid in a block, not as a loose transaction
if (tx.IsCoinBase())
return state.DoS(100, false, REJECT_INVALID, "coinbase");
@ -866,6 +863,12 @@ bool AcceptToMemoryPoolWorker(CTxMemPool& pool, CValidationState& state, const C
return state.DoS(0, false, REJECT_NONSTANDARD, "too-long-mempool-chain", false, errString);
}
// check special TXs after all the other checks. If we'd do this before the other checks, we might end up
// DoS scoring a node for non-critical errors, e.g. duplicate keys because a TX is received that was already
// mined
if (!CheckSpecialTx(tx, chainActive.Tip(), state))
return false;
// If we aren't going to actually accept it but just were verifying it, we are fine already
if(fDryRun) return true;