Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13711270
D10871.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Subscribers
None
D10871.diff
View Options
diff --git a/src/net.h b/src/net.h
--- a/src/net.h
+++ b/src/net.h
@@ -1096,8 +1096,6 @@
mapMsgCmdSize mapRecvBytesPerMsgCmd GUARDED_BY(cs_vRecv);
public:
- BlockHash hashContinue;
-
// flood relay
std::vector<CAddress> vAddrToSend;
std::unique_ptr<CRollingBloomFilter> m_addr_known = nullptr;
diff --git a/src/net.cpp b/src/net.cpp
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -3335,7 +3335,6 @@
m_inbound_onion(inbound_onion) {
hSocket = hSocketIn;
addrName = addrNameIn == "" ? addr.ToStringIPPort() : addrNameIn;
- hashContinue = BlockHash();
if (conn_type_in != ConnectionType::BLOCK_RELAY) {
m_tx_relay = std::make_unique<TxRelay>();
}
diff --git a/src/net_processing.h b/src/net_processing.h
--- a/src/net_processing.h
+++ b/src/net_processing.h
@@ -93,6 +93,13 @@
/** This peer's reported block height when we connected */
std::atomic<int> m_starting_height{-1};
+ /**
+ * The final block hash that we sent in an `inv` message to this peer.
+ * When the peer requests this block, we send an `inv` message to trigger
+ * the peer to request the next sequence of block hashes.
+ * Most peers use headers-first syncing, which doesn't use this mechanism
+ */
+ BlockHash m_continuation_block{};
/**
* Set of txids to reconsider once their parent transactions have been
diff --git a/src/net_processing.cpp b/src/net_processing.cpp
--- a/src/net_processing.cpp
+++ b/src/net_processing.cpp
@@ -1894,7 +1894,7 @@
connman.ForEachNodeThen(std::move(sortfunc), std::move(pushfunc));
}
-static void ProcessGetBlockData(const Config &config, CNode &pfrom,
+static void ProcessGetBlockData(const Config &config, CNode &pfrom, Peer &peer,
const CInv &inv, CConnman &connman,
const std::atomic<bool> &interruptMsgProc) {
const Consensus::Params &consensusParams =
@@ -2057,7 +2057,7 @@
// Trigger the peer node to send a getblocks request for the next batch
// of inventory.
- if (hash == pfrom.hashContinue) {
+ if (hash == peer.m_continuation_block) {
// Send immediately. This must send even if redundant, and
// we want it right after the last block so they don't wait for
// other stuff first.
@@ -2065,7 +2065,7 @@
vInv.push_back(
CInv(MSG_BLOCK, ::ChainActive().Tip()->GetBlockHash()));
connman.PushMessage(&pfrom, msgMaker.Make(NetMsgType::INV, vInv));
- pfrom.hashContinue = BlockHash();
+ peer.m_continuation_block = BlockHash();
}
}
}
@@ -2257,7 +2257,8 @@
if (it != peer.m_getdata_requests.end() && !pfrom.fPauseSend) {
const CInv &inv = *it++;
if (inv.IsGenBlkMsg()) {
- ProcessGetBlockData(config, pfrom, inv, connman, interruptMsgProc);
+ ProcessGetBlockData(config, pfrom, peer, inv, connman,
+ interruptMsgProc);
}
// else: If the first item on the queue is an unknown type, we erase it
// and continue processing the queue on the next call.
@@ -3531,7 +3532,7 @@
// trigger the peer to getblocks the next batch of inventory.
LogPrint(BCLog::NET, " getblocks stopping at limit %d %s\n",
pindex->nHeight, pindex->GetBlockHash().ToString());
- pfrom.hashContinue = pindex->GetBlockHash();
+ peer->m_continuation_block = pindex->GetBlockHash();
break;
}
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Apr 26, 11:17 (11 h, 5 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5573385
Default Alt Text
D10871.diff (3 KB)
Attached To
D10871: [net processing] Move hashContinue to net processing
Event Timeline
Log In to Comment