mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-17 13:07:54 +02:00
Merge 0101110f9b into merged_master (Bitcoin PR #19322)
This commit is contained in:
commit
74c41d1142
2 changed files with 16 additions and 15 deletions
20
src/net.h
20
src/net.h
|
|
@ -973,19 +973,21 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
void PushInventory(const CInv& inv)
|
||||
void PushTxInventory(const uint256& hash)
|
||||
{
|
||||
if (inv.type == MSG_TX && m_tx_relay != nullptr) {
|
||||
LOCK(m_tx_relay->cs_tx_inventory);
|
||||
if (!m_tx_relay->filterInventoryKnown.contains(inv.hash)) {
|
||||
m_tx_relay->setInventoryTxToSend.insert(inv.hash);
|
||||
}
|
||||
} else if (inv.type == MSG_BLOCK) {
|
||||
LOCK(cs_inventory);
|
||||
vInventoryBlockToSend.push_back(inv.hash);
|
||||
if (m_tx_relay == nullptr) return;
|
||||
LOCK(m_tx_relay->cs_tx_inventory);
|
||||
if (!m_tx_relay->filterInventoryKnown.contains(hash)) {
|
||||
m_tx_relay->setInventoryTxToSend.insert(hash);
|
||||
}
|
||||
}
|
||||
|
||||
void PushBlockInventory(const uint256& hash)
|
||||
{
|
||||
LOCK(cs_inventory);
|
||||
vInventoryBlockToSend.push_back(hash);
|
||||
}
|
||||
|
||||
void PushBlockHash(const uint256 &hash)
|
||||
{
|
||||
LOCK(cs_inventory);
|
||||
|
|
|
|||
|
|
@ -1419,10 +1419,9 @@ bool static AlreadyHave(const CInv& inv, const CTxMemPool& mempool) EXCLUSIVE_LO
|
|||
|
||||
void RelayTransaction(const uint256& txid, const CConnman& connman)
|
||||
{
|
||||
CInv inv(MSG_TX, txid);
|
||||
connman.ForEachNode([&inv](CNode* pnode)
|
||||
connman.ForEachNode([&txid](CNode* pnode)
|
||||
{
|
||||
pnode->PushInventory(inv);
|
||||
pnode->PushTxInventory(txid);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -1608,7 +1607,7 @@ void static ProcessGetBlockData(CNode& pfrom, const CChainParams& chainparams, c
|
|||
// Trigger the peer node to send a getblocks request for the next batch of inventory
|
||||
if (inv.hash == pfrom.hashContinue)
|
||||
{
|
||||
// Bypass PushInventory, this must send even if redundant,
|
||||
// Bypass PushBlockInventory, this must send even if redundant,
|
||||
// and we want it right after the last block so they don't
|
||||
// wait for other stuff first.
|
||||
std::vector<CInv> vInv;
|
||||
|
|
@ -2657,7 +2656,7 @@ bool ProcessMessage(CNode& pfrom, const std::string& msg_type, CDataStream& vRec
|
|||
LogPrint(BCLog::NET, " getblocks stopping, pruned or too old block at %d %s\n", pindex->nHeight, pindex->GetBlockHash().ToString());
|
||||
break;
|
||||
}
|
||||
pfrom.PushInventory(CInv(MSG_BLOCK, pindex->GetBlockHash()));
|
||||
pfrom.PushBlockInventory(pindex->GetBlockHash());
|
||||
if (--nLimit <= 0)
|
||||
{
|
||||
// When this block is requested, we'll send an inv that'll
|
||||
|
|
@ -4081,7 +4080,7 @@ bool PeerLogicValidation::SendMessages(CNode* pto)
|
|||
|
||||
// If the peer's chain has this block, don't inv it back.
|
||||
if (!PeerHasHeader(&state, pindex)) {
|
||||
pto->PushInventory(CInv(MSG_BLOCK, hashToAnnounce));
|
||||
pto->PushBlockInventory(hashToAnnounce);
|
||||
LogPrint(BCLog::NET, "%s: sending inv peer=%d hash=%s\n", __func__,
|
||||
pto->GetId(), hashToAnnounce.ToString());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue