Skip to content

Commit 14d4eef

Browse files
committed
Fix removing of orphan transactions
We don't want to erase orphans that still have missing inputs, they should still be tracked as orphans. Also, the transaction thats being accepted can't be an orphan otherwise it would have previously been accepted, so doesn't need to be added to the erase queue.
1 parent 7efc9cf commit 14d4eef

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/main.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3979,7 +3979,6 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
39793979
mempool.check(pcoinsTip);
39803980
RelayTransaction(tx);
39813981
vWorkQueue.push_back(inv.hash);
3982-
vEraseQueue.push_back(inv.hash);
39833982

39843983
LogPrint("mempool", "AcceptToMemoryPool: peer=%d %s: accepted %s (poolsz %u)\n",
39853984
pfrom->id, pfrom->cleanSubVer,
@@ -4006,7 +4005,6 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
40064005
// anyone relaying LegitTxX banned)
40074006
CValidationState stateDummy;
40084007

4009-
vEraseQueue.push_back(orphanHash);
40104008

40114009
if (setMisbehaving.count(fromPeer))
40124010
continue;
@@ -4015,6 +4013,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
40154013
LogPrint("mempool", " accepted orphan tx %s\n", orphanHash.ToString());
40164014
RelayTransaction(orphanTx);
40174015
vWorkQueue.push_back(orphanHash);
4016+
vEraseQueue.push_back(orphanHash);
40184017
}
40194018
else if (!fMissingInputs2)
40204019
{
@@ -4026,8 +4025,10 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
40264025
setMisbehaving.insert(fromPeer);
40274026
LogPrint("mempool", " invalid orphan tx %s\n", orphanHash.ToString());
40284027
}
4029-
// too-little-fee orphan
4028+
// Has inputs but not accepted to mempool
4029+
// Probably non-standard or insufficient fee/priority
40304030
LogPrint("mempool", " removed orphan tx %s\n", orphanHash.ToString());
4031+
vEraseQueue.push_back(orphanHash);
40314032
}
40324033
mempool.check(pcoinsTip);
40334034
}

0 commit comments

Comments
 (0)