mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-20 07:09:15 +01:00
txorphanage: Extract GetOrphanTx
Extract orphan lookup code into GetOrphanTx function.
This commit is contained in:
@@ -2104,10 +2104,9 @@ void PeerManagerImpl::ProcessOrphanTx(std::set<uint256>& orphan_work_set)
|
||||
const uint256 orphanHash = *orphan_work_set.begin();
|
||||
orphan_work_set.erase(orphan_work_set.begin());
|
||||
|
||||
auto orphan_it = mapOrphanTransactions.find(orphanHash);
|
||||
if (orphan_it == mapOrphanTransactions.end()) continue;
|
||||
const auto [porphanTx, from_peer] = GetOrphanTx(orphanHash);
|
||||
if (porphanTx == nullptr) continue;
|
||||
|
||||
const CTransactionRef porphanTx = orphan_it->second.tx;
|
||||
const MempoolAcceptResult result = AcceptToMemoryPool(::ChainstateActive(), m_mempool, porphanTx, false /* bypass_limits */);
|
||||
const TxValidationState& state = result.m_state;
|
||||
|
||||
@@ -2124,10 +2123,10 @@ void PeerManagerImpl::ProcessOrphanTx(std::set<uint256>& orphan_work_set)
|
||||
if (state.IsInvalid()) {
|
||||
LogPrint(BCLog::MEMPOOL, " invalid orphan tx %s from peer=%d. %s\n",
|
||||
orphanHash.ToString(),
|
||||
orphan_it->second.fromPeer,
|
||||
from_peer,
|
||||
state.ToString());
|
||||
// Maybe punish peer that gave us an invalid orphan tx
|
||||
MaybePunishNodeForTx(orphan_it->second.fromPeer, state);
|
||||
MaybePunishNodeForTx(from_peer, state);
|
||||
}
|
||||
// Has inputs but not accepted to mempool
|
||||
// Probably non-standard or insufficient fee
|
||||
|
||||
Reference in New Issue
Block a user