Skip to content

Commit 86cff8b

Browse files
committed
alias BlockDownloadMap for mapBlocksInFlight
1 parent ccc431d commit 86cff8b

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/net_processing.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -899,7 +899,8 @@ class PeerManagerImpl final : public PeerManager
899899
*/
900900
void FindNextBlocksToDownload(const Peer& peer, unsigned int count, std::vector<const CBlockIndex*>& vBlocks, NodeId& nodeStaller) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
901901

902-
std::map<uint256, std::pair<NodeId, std::list<QueuedBlock>::iterator> > mapBlocksInFlight GUARDED_BY(cs_main);
902+
typedef std::map<uint256, std::pair<NodeId, std::list<QueuedBlock>::iterator>> BlockDownloadMap;
903+
BlockDownloadMap mapBlocksInFlight GUARDED_BY(cs_main);
903904

904905
/** When our tip was last updated. */
905906
std::atomic<std::chrono::seconds> m_last_tip_update{0s};
@@ -1117,7 +1118,7 @@ std::chrono::microseconds PeerManagerImpl::NextInvToInbounds(std::chrono::micros
11171118

11181119
bool PeerManagerImpl::IsBlockRequested(const uint256& hash)
11191120
{
1120-
return mapBlocksInFlight.find(hash) != mapBlocksInFlight.end();
1121+
return mapBlocksInFlight.count(hash);
11211122
}
11221123

11231124
void PeerManagerImpl::RemoveBlockRequest(const uint256& hash, std::optional<NodeId> from_peer)
@@ -1161,7 +1162,7 @@ bool PeerManagerImpl::BlockRequested(NodeId nodeid, const CBlockIndex& block, st
11611162
assert(state != nullptr);
11621163

11631164
// Short-circuit most stuff in case it is from the same node
1164-
std::map<uint256, std::pair<NodeId, std::list<QueuedBlock>::iterator> >::iterator itInFlight = mapBlocksInFlight.find(hash);
1165+
BlockDownloadMap::iterator itInFlight = mapBlocksInFlight.find(hash);
11651166
if (itInFlight != mapBlocksInFlight.end() && itInFlight->second.first == nodeid) {
11661167
if (pit) {
11671168
*pit = &itInFlight->second.second;
@@ -4274,7 +4275,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
42744275
nodestate->m_last_block_announcement = GetTime();
42754276
}
42764277

4277-
std::map<uint256, std::pair<NodeId, std::list<QueuedBlock>::iterator> >::iterator blockInFlightIt = mapBlocksInFlight.find(pindex->GetBlockHash());
4278+
BlockDownloadMap::iterator blockInFlightIt = mapBlocksInFlight.find(pindex->GetBlockHash());
42784279
bool fAlreadyInFlight = blockInFlightIt != mapBlocksInFlight.end();
42794280

42804281
if (pindex->nStatus & BLOCK_HAVE_DATA) // Nothing to do here
@@ -4433,7 +4434,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
44334434
{
44344435
LOCK(cs_main);
44354436

4436-
std::map<uint256, std::pair<NodeId, std::list<QueuedBlock>::iterator> >::iterator it = mapBlocksInFlight.find(resp.blockhash);
4437+
BlockDownloadMap::iterator it = mapBlocksInFlight.find(resp.blockhash);
44374438
if (it == mapBlocksInFlight.end() || !it->second.second->partialBlock ||
44384439
it->second.first != pfrom.GetId()) {
44394440
LogPrint(BCLog::NET, "Peer %d sent us block transactions for block we weren't expecting\n", pfrom.GetId());

0 commit comments

Comments
 (0)