mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-11 20:32:35 -03:00
Make sure unconfirmed parents are requestable
This commit is contained in:
parent
c4626bcd21
commit
f32c408f3a
1 changed files with 11 additions and 0 deletions
|
@ -1694,6 +1694,17 @@ void static ProcessGetData(CNode& pfrom, const CChainParams& chainparams, CConnm
|
||||||
int nSendFlags = (inv.type == MSG_TX ? SERIALIZE_TRANSACTION_NO_WITNESS : 0);
|
int nSendFlags = (inv.type == MSG_TX ? SERIALIZE_TRANSACTION_NO_WITNESS : 0);
|
||||||
connman->PushMessage(&pfrom, msgMaker.Make(nSendFlags, NetMsgType::TX, *tx));
|
connman->PushMessage(&pfrom, msgMaker.Make(nSendFlags, NetMsgType::TX, *tx));
|
||||||
mempool.RemoveUnbroadcastTx(inv.hash);
|
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 {
|
} else {
|
||||||
vNotFound.push_back(inv);
|
vNotFound.push_back(inv);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue