Skip to content

Commit

Permalink
Add ContainsTransaction Recheck when ParallelVerifiedTransaction Rece…
Browse files Browse the repository at this point in the history
…ived (#1408)

* add containsTx recheck

* add UT

* Update to just View check

* update

* revert

* Update UT_Blockchain.cs

Co-authored-by: Vitor Nazário Coelho <vncoelho@gmail.com>
  • Loading branch information
eryeer and vncoelho committed Jan 13, 2020
1 parent 040f3b8 commit 49b8518
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/neo/Ledger/Blockchain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,9 @@ private void OnParallelVerified(ParallelVerified parallelVerified)
RelayResultReason reason = parallelVerified.VerifyResult;
if (reason == RelayResultReason.Succeed)
{
if (!MemPool.CanTransactionFitInPool(parallelVerified.Transaction))
if (View.ContainsTransaction(parallelVerified.Transaction.Hash))
reason = RelayResultReason.AlreadyExists;
else if (!MemPool.CanTransactionFitInPool(parallelVerified.Transaction))
reason = RelayResultReason.OutOfMemory;
else if (!MemPool.TryAdd(parallelVerified.Transaction.Hash, parallelVerified.Transaction))
reason = RelayResultReason.OutOfMemory;
Expand Down

0 comments on commit 49b8518

Please sign in to comment.