Do not ban nodes which relay expired transactions

This commit is contained in:
Duke Leto
2022-09-06 10:03:47 -04:00
parent 9c5e5c550c
commit 55703fdb95

View File

@@ -1304,10 +1304,12 @@ bool ContextualCheckTransaction(int32_t slowflag,const CBlock *block, CBlockInde
// Check that all transactions are unexpired
if (IsExpiredTx(tx, nHeight)) {
// Don't increase banscore if the transaction only just expired
int expiredDosLevel = IsExpiredTx(tx, nHeight - 1) ? (dosLevel > 10 ? dosLevel : 10) : 0;
//int expiredDosLevel = IsExpiredTx(tx, nHeight - 1) ? (dosLevel > 10 ? dosLevel : 10) : 0;
//string strHex = EncodeHexTx(tx);
//fprintf(stderr, "transaction exipred.%s\n",strHex.c_str());
return state.DoS(expiredDosLevel, error("ContextualCheckTransaction(): transaction %s is expired, expiry block %i vs current block %i\n",tx.GetHash().ToString(),tx.nExpiryHeight,nHeight), REJECT_INVALID, "tx-overwinter-expired");
//fprintf(stderr, "transaction expired.%s\n",strHex.c_str());
// Do not ban nodes which relay expired tx's, it's a bug not an attack
return state.DoS(0, error("ContextualCheckTransaction(): transaction %s is expired, expiry block %i vs current block %i\n",tx.GetHash().ToString(),tx.nExpiryHeight,nHeight), REJECT_INVALID, "tx-overwinter-expired");
}
}