diff options
author | Pieter Wuille <pieter.wuille@gmail.com> | 2020-06-06 10:25:21 -0700 |
---|---|---|
committer | Pieter Wuille <pieter@wuille.net> | 2020-07-08 18:33:51 -0700 |
commit | f32c408f3a0b7e597977df2bc2cdc4ae298586e5 (patch) | |
tree | b0e10e4ca19e244cc4e7794843b4f3c583cf551d | |
parent | c4626bcd211af08c85b6567ef07eeae333edba47 (diff) |
Make sure unconfirmed parents are requestable
-rw-r--r-- | src/net_processing.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/net_processing.cpp b/src/net_processing.cpp index c8d03da659..9a4cd7d0d5 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -1694,6 +1694,17 @@ void static ProcessGetData(CNode& pfrom, const CChainParams& chainparams, CConnm int nSendFlags = (inv.type == MSG_TX ? SERIALIZE_TRANSACTION_NO_WITNESS : 0); connman->PushMessage(&pfrom, msgMaker.Make(nSendFlags, NetMsgType::TX, *tx)); mempool.RemoveUnbroadcastTx(inv.hash); + // As we're going to send tx, make sure its unconfirmed parents are made requestable. + for (const auto& txin : tx->vin) { + auto txinfo = mempool.info(txin.prevout.hash); + if (txinfo.tx && txinfo.m_time > now - UNCONDITIONAL_RELAY_DELAY) { + // Relaying a transaction with a recent but unconfirmed parent. + if (WITH_LOCK(pfrom.m_tx_relay->cs_tx_inventory, return !pfrom.m_tx_relay->filterInventoryKnown.contains(txin.prevout.hash))) { + LOCK(cs_main); + State(pfrom.GetId())->m_recently_announced_invs.insert(txin.prevout.hash); + } + } + } } else { vNotFound.push_back(inv); } |