mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-25 02:33:24 -03:00
[refactor] move invalid package processing to TxDownload
This commit is contained in:
parent
c4ce0c1218
commit
257568eab5
4 changed files with 14 additions and 1 deletions
|
@ -3029,7 +3029,7 @@ void PeerManagerImpl::ProcessPackageResult(const node::PackageToValidate& packag
|
||||||
const auto& senders = package_to_validate.m_senders;
|
const auto& senders = package_to_validate.m_senders;
|
||||||
|
|
||||||
if (package_result.m_state.IsInvalid()) {
|
if (package_result.m_state.IsInvalid()) {
|
||||||
RecentRejectsReconsiderableFilter().insert(GetPackageHash(package));
|
m_txdownloadman.MempoolRejectedPackage(package);
|
||||||
}
|
}
|
||||||
// We currently only expect to process 1-parent-1-child packages. Remove if this changes.
|
// We currently only expect to process 1-parent-1-child packages. Remove if this changes.
|
||||||
if (!Assume(package.size() == 2)) return;
|
if (!Assume(package.size() == 2)) return;
|
||||||
|
|
|
@ -168,6 +168,9 @@ public:
|
||||||
|
|
||||||
/** Respond to transaction rejected from mempool */
|
/** Respond to transaction rejected from mempool */
|
||||||
RejectedTxTodo MempoolRejectedTx(const CTransactionRef& ptx, const TxValidationState& state, NodeId nodeid, bool first_time_failure);
|
RejectedTxTodo MempoolRejectedTx(const CTransactionRef& ptx, const TxValidationState& state, NodeId nodeid, bool first_time_failure);
|
||||||
|
|
||||||
|
/** Respond to package rejected from mempool */
|
||||||
|
void MempoolRejectedPackage(const Package& package);
|
||||||
};
|
};
|
||||||
} // namespace node
|
} // namespace node
|
||||||
#endif // BITCOIN_NODE_TXDOWNLOADMAN_H
|
#endif // BITCOIN_NODE_TXDOWNLOADMAN_H
|
||||||
|
|
|
@ -79,6 +79,10 @@ RejectedTxTodo TxDownloadManager::MempoolRejectedTx(const CTransactionRef& ptx,
|
||||||
{
|
{
|
||||||
return m_impl->MempoolRejectedTx(ptx, state, nodeid, first_time_failure);
|
return m_impl->MempoolRejectedTx(ptx, state, nodeid, first_time_failure);
|
||||||
}
|
}
|
||||||
|
void TxDownloadManager::MempoolRejectedPackage(const Package& package)
|
||||||
|
{
|
||||||
|
m_impl->MempoolRejectedPackage(package);
|
||||||
|
}
|
||||||
|
|
||||||
// TxDownloadManagerImpl
|
// TxDownloadManagerImpl
|
||||||
void TxDownloadManagerImpl::ActiveTipChange()
|
void TxDownloadManagerImpl::ActiveTipChange()
|
||||||
|
@ -441,4 +445,9 @@ node::RejectedTxTodo TxDownloadManagerImpl::MempoolRejectedTx(const CTransaction
|
||||||
.m_package_to_validate = std::move(package_to_validate)
|
.m_package_to_validate = std::move(package_to_validate)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TxDownloadManagerImpl::MempoolRejectedPackage(const Package& package)
|
||||||
|
{
|
||||||
|
RecentRejectsReconsiderableFilter().insert(GetPackageHash(package));
|
||||||
|
}
|
||||||
} // namespace node
|
} // namespace node
|
||||||
|
|
|
@ -166,6 +166,7 @@ public:
|
||||||
|
|
||||||
void MempoolAcceptedTx(const CTransactionRef& tx);
|
void MempoolAcceptedTx(const CTransactionRef& tx);
|
||||||
RejectedTxTodo MempoolRejectedTx(const CTransactionRef& ptx, const TxValidationState& state, NodeId nodeid, bool first_time_failure);
|
RejectedTxTodo MempoolRejectedTx(const CTransactionRef& ptx, const TxValidationState& state, NodeId nodeid, bool first_time_failure);
|
||||||
|
void MempoolRejectedPackage(const Package& package);
|
||||||
};
|
};
|
||||||
} // namespace node
|
} // namespace node
|
||||||
#endif // BITCOIN_NODE_TXDOWNLOADMAN_IMPL_H
|
#endif // BITCOIN_NODE_TXDOWNLOADMAN_IMPL_H
|
||||||
|
|
Loading…
Add table
Reference in a new issue