|
|
@ -2059,12 +2059,9 @@ void PeerManager::ProcessOrphanTx(std::set<uint256>& orphan_work_set, std::list<
|
|
|
|
const CTransactionRef porphanTx = orphan_it->second.tx;
|
|
|
|
const CTransactionRef porphanTx = orphan_it->second.tx;
|
|
|
|
const CTransaction& orphanTx = *porphanTx;
|
|
|
|
const CTransaction& orphanTx = *porphanTx;
|
|
|
|
NodeId fromPeer = orphan_it->second.fromPeer;
|
|
|
|
NodeId fromPeer = orphan_it->second.fromPeer;
|
|
|
|
// Use a new TxValidationState because orphans come from different peers (and we call
|
|
|
|
TxValidationState state;
|
|
|
|
// MaybePunishNodeForTx based on the source peer from the orphan map, not based on the peer
|
|
|
|
|
|
|
|
// that relayed the previous transaction).
|
|
|
|
|
|
|
|
TxValidationState orphan_state;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (AcceptToMemoryPool(m_mempool, orphan_state, porphanTx, &removed_txn, false /* bypass_limits */, 0 /* nAbsurdFee */)) {
|
|
|
|
if (AcceptToMemoryPool(m_mempool, state, porphanTx, &removed_txn, false /* bypass_limits */, 0 /* nAbsurdFee */)) {
|
|
|
|
LogPrint(BCLog::MEMPOOL, " accepted orphan tx %s\n", orphanHash.ToString());
|
|
|
|
LogPrint(BCLog::MEMPOOL, " accepted orphan tx %s\n", orphanHash.ToString());
|
|
|
|
RelayTransaction(orphanHash, porphanTx->GetWitnessHash(), m_connman);
|
|
|
|
RelayTransaction(orphanHash, porphanTx->GetWitnessHash(), m_connman);
|
|
|
|
for (unsigned int i = 0; i < orphanTx.vout.size(); i++) {
|
|
|
|
for (unsigned int i = 0; i < orphanTx.vout.size(); i++) {
|
|
|
@ -2077,19 +2074,19 @@ void PeerManager::ProcessOrphanTx(std::set<uint256>& orphan_work_set, std::list<
|
|
|
|
}
|
|
|
|
}
|
|
|
|
EraseOrphanTx(orphanHash);
|
|
|
|
EraseOrphanTx(orphanHash);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
} else if (orphan_state.GetResult() != TxValidationResult::TX_MISSING_INPUTS) {
|
|
|
|
} else if (state.GetResult() != TxValidationResult::TX_MISSING_INPUTS) {
|
|
|
|
if (orphan_state.IsInvalid()) {
|
|
|
|
if (state.IsInvalid()) {
|
|
|
|
LogPrint(BCLog::MEMPOOL, " invalid orphan tx %s from peer=%d. %s\n",
|
|
|
|
LogPrint(BCLog::MEMPOOL, " invalid orphan tx %s from peer=%d. %s\n",
|
|
|
|
orphanHash.ToString(),
|
|
|
|
orphanHash.ToString(),
|
|
|
|
fromPeer,
|
|
|
|
fromPeer,
|
|
|
|
orphan_state.ToString());
|
|
|
|
state.ToString());
|
|
|
|
// Maybe punish peer that gave us an invalid orphan tx
|
|
|
|
// Maybe punish peer that gave us an invalid orphan tx
|
|
|
|
MaybePunishNodeForTx(fromPeer, orphan_state);
|
|
|
|
MaybePunishNodeForTx(fromPeer, state);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Has inputs but not accepted to mempool
|
|
|
|
// Has inputs but not accepted to mempool
|
|
|
|
// Probably non-standard or insufficient fee
|
|
|
|
// Probably non-standard or insufficient fee
|
|
|
|
LogPrint(BCLog::MEMPOOL, " removed orphan tx %s\n", orphanHash.ToString());
|
|
|
|
LogPrint(BCLog::MEMPOOL, " removed orphan tx %s\n", orphanHash.ToString());
|
|
|
|
if (orphan_state.GetResult() != TxValidationResult::TX_WITNESS_STRIPPED) {
|
|
|
|
if (state.GetResult() != TxValidationResult::TX_WITNESS_STRIPPED) {
|
|
|
|
// We can add the wtxid of this transaction to our reject filter.
|
|
|
|
// We can add the wtxid of this transaction to our reject filter.
|
|
|
|
// Do not add txids of witness transactions or witness-stripped
|
|
|
|
// Do not add txids of witness transactions or witness-stripped
|
|
|
|
// transactions to the filter, as they can have been malleated;
|
|
|
|
// transactions to the filter, as they can have been malleated;
|
|
|
@ -2113,7 +2110,7 @@ void PeerManager::ProcessOrphanTx(std::set<uint256>& orphan_work_set, std::list<
|
|
|
|
// processing of this transaction in the event that child
|
|
|
|
// processing of this transaction in the event that child
|
|
|
|
// transactions are later received (resulting in
|
|
|
|
// transactions are later received (resulting in
|
|
|
|
// parent-fetching by txid via the orphan-handling logic).
|
|
|
|
// parent-fetching by txid via the orphan-handling logic).
|
|
|
|
if (orphan_state.GetResult() == TxValidationResult::TX_INPUTS_NOT_STANDARD && orphanTx.GetWitnessHash() != orphanTx.GetHash()) {
|
|
|
|
if (state.GetResult() == TxValidationResult::TX_INPUTS_NOT_STANDARD && orphanTx.GetWitnessHash() != orphanTx.GetHash()) {
|
|
|
|
// We only add the txid if it differs from the wtxid, to
|
|
|
|
// We only add the txid if it differs from the wtxid, to
|
|
|
|
// avoid wasting entries in the rolling bloom filter.
|
|
|
|
// avoid wasting entries in the rolling bloom filter.
|
|
|
|
recentRejects->insert(orphanTx.GetHash());
|
|
|
|
recentRejects->insert(orphanTx.GetHash());
|
|
|
|