ProcessOrphanTx: Remove aliases

pull/19498/head
John Newbery 4 years ago
parent e07c5d9423
commit 4fce726bd1

@ -2057,14 +2057,12 @@ void PeerManager::ProcessOrphanTx(std::set<uint256>& orphan_work_set, std::list<
if (orphan_it == mapOrphanTransactions.end()) continue; if (orphan_it == mapOrphanTransactions.end()) continue;
const CTransactionRef porphanTx = orphan_it->second.tx; const CTransactionRef porphanTx = orphan_it->second.tx;
const CTransaction& orphanTx = *porphanTx;
NodeId fromPeer = orphan_it->second.fromPeer;
TxValidationState state; TxValidationState state;
if (AcceptToMemoryPool(m_mempool, 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 < porphanTx->vout.size(); i++) {
auto it_by_prev = mapOrphanTransactionsByPrev.find(COutPoint(orphanHash, i)); auto it_by_prev = mapOrphanTransactionsByPrev.find(COutPoint(orphanHash, i));
if (it_by_prev != mapOrphanTransactionsByPrev.end()) { if (it_by_prev != mapOrphanTransactionsByPrev.end()) {
for (const auto& elem : it_by_prev->second) { for (const auto& elem : it_by_prev->second) {
@ -2078,10 +2076,10 @@ void PeerManager::ProcessOrphanTx(std::set<uint256>& orphan_work_set, std::list<
if (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, orphan_it->second.fromPeer,
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, state); MaybePunishNodeForTx(orphan_it->second.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
@ -2101,7 +2099,7 @@ void PeerManager::ProcessOrphanTx(std::set<uint256>& orphan_work_set, std::list<
// for concerns around weakening security of unupgraded nodes // for concerns around weakening security of unupgraded nodes
// if we start doing this too early. // if we start doing this too early.
assert(recentRejects); assert(recentRejects);
recentRejects->insert(orphanTx.GetWitnessHash()); recentRejects->insert(porphanTx->GetWitnessHash());
// If the transaction failed for TX_INPUTS_NOT_STANDARD, // If the transaction failed for TX_INPUTS_NOT_STANDARD,
// then we know that the witness was irrelevant to the policy // then we know that the witness was irrelevant to the policy
// failure, since this check depends only on the txid // failure, since this check depends only on the txid
@ -2110,10 +2108,10 @@ 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 (state.GetResult() == TxValidationResult::TX_INPUTS_NOT_STANDARD && orphanTx.GetWitnessHash() != orphanTx.GetHash()) { if (state.GetResult() == TxValidationResult::TX_INPUTS_NOT_STANDARD && porphanTx->GetWitnessHash() != porphanTx->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(porphanTx->GetHash());
} }
} }
EraseOrphanTx(orphanHash); EraseOrphanTx(orphanHash);

Loading…
Cancel
Save