MCPcopy Create free account
hub / github.com/Bitcoin-ABC/bitcoin-abc / ProcessOrphanTx

Method ProcessOrphanTx

src/net_processing.cpp:4481–4519  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4479}
4480
4481bool PeerManagerImpl::ProcessOrphanTx(const Config &config, Peer &peer) {
4482 AssertLockHeld(g_msgproc_mutex);
4483 LOCK(cs_main);
4484
4485 while (CTransactionRef porphanTx =
4486 m_mempool.withOrphanage([&peer](TxOrphanage &orphanage) {
4487 return orphanage.GetTxToReconsider(peer.m_id);
4488 })) {
4489 const MempoolAcceptResult result =
4490 m_chainman.ProcessTransaction(porphanTx);
4491 const TxValidationState &state = result.m_state;
4492 const TxId &orphanTxId = porphanTx->GetId();
4493
4494 if (result.m_result_type == MempoolAcceptResult::ResultType::VALID) {
4495 LogPrint(BCLog::TXPACKAGES, " accepted orphan tx %s\n",
4496 orphanTxId.ToString());
4497 ProcessValidTx(peer.m_id, porphanTx);
4498 return true;
4499 }
4500
4501 if (state.GetResult() != TxValidationResult::TX_MISSING_INPUTS) {
4502 LogPrint(BCLog::TXPACKAGES,
4503 " invalid orphan tx %s from peer=%d. %s\n",
4504 orphanTxId.ToString(), peer.m_id, state.ToString());
4505
4506 if (Assume(state.IsInvalid() &&
4507 state.GetResult() != TxValidationResult::TX_NO_MEMPOOL &&
4508 state.GetResult() !=
4509 TxValidationResult::TX_RESULT_UNSET)) {
4510 ProcessInvalidTx(peer.m_id, porphanTx, state,
4511 /*maybe_add_extra_compact_tx=*/false);
4512 }
4513
4514 return true;
4515 }
4516 }
4517
4518 return false;
4519}
4520
4521bool PeerManagerImpl::PrepareBlockFilterRequest(
4522 CNode &node, Peer &peer, BlockFilterType filter_type, uint32_t start_height,

Callers

nothing calls this directly

Calls 6

GetTxToReconsiderMethod · 0.80
ProcessTransactionMethod · 0.80
GetResultMethod · 0.80
IsInvalidMethod · 0.80
GetIdMethod · 0.45
ToStringMethod · 0.45

Tested by

no test coverage detected