Skip to content

Commit 80d11fd

Browse files
author
deeponion
committed
fixed bad tx issue
1 parent 34ef988 commit 80d11fd

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/main.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -748,6 +748,16 @@ bool CTxMemPool::accept(CTxDB& txdb, CTransaction &tx, bool fCheckInputs,
748748

749749
if (!tx.CheckTransaction())
750750
return error("CTxMemPool::accept() : CheckTransaction failed");
751+
752+
// DeepOnion: check stealth tx, making sure the narration length does not exceed 24 ch, to avoid exploit
753+
if((pindexBest->nHeight >= SWITCH_BLOCK_HARD_FORK && !fTestNet)
754+
|| (pindexBest->nHeight >= SWITCH_BLOCK_HARD_FORK_TESTNET_NARRATION_FIX && fTestNet))
755+
{
756+
if(!tx.CheckStealthTxNarrSize())
757+
{
758+
return tx.DoS(100, error("CTxMemPool::accept() : CheckStealthTxNarrSize failed"));
759+
}
760+
}
751761

752762
// Coinbase is only valid in a block, not as a loose transaction
753763
if (tx.IsCoinBase())
@@ -2374,8 +2384,11 @@ bool CBlock::CheckBlock(bool fCheckPOW, bool fCheckMerkleRoot, bool fCheckSig) c
23742384
// DeepOnion: check stealth tx, making sure the narration length does not exceed 24 ch, to avoid exploit
23752385
if(fCheckSig && ((pindexBest->nHeight >= SWITCH_BLOCK_HARD_FORK && !fTestNet)
23762386
|| (pindexBest->nHeight >= SWITCH_BLOCK_HARD_FORK_TESTNET_NARRATION_FIX && fTestNet)))
2377-
if(!tx.CheckStealthTxNarrSize())
2387+
if(!tx.CheckStealthTxNarrSize())
2388+
{
2389+
mempool.remove(tx);
23782390
return DoS(tx.nDoS, error("CheckBlock() : CheckStealthTxNarrSize failed"));
2391+
}
23792392
}
23802393

23812394
// Check for duplicate txids. This is caught by ConnectInputs(),

0 commit comments

Comments
 (0)