aboutsummaryrefslogtreecommitdiff
path: root/src/net_processing.cpp
diff options
context:
space:
mode:
authorSjors Provoost <sjors@sprovoost.nl>2021-12-08 19:17:29 +0700
committerSjors Provoost <sjors@sprovoost.nl>2021-12-24 16:28:53 +0100
commit0e3d7c5ee16d5a4c061ab9a57285bceb7899b512 (patch)
tree6b99fdec1acf9cb787db61f0a8c1d1cab2e5e556 /src/net_processing.cpp
parent8d1a3e6498de6087501969a9d243b0697ca3fe97 (diff)
downloadbitcoin-0e3d7c5ee16d5a4c061ab9a57285bceb7899b512.tar.xz
refactor: drop redundant hash argument from FetchBlock
Diffstat (limited to 'src/net_processing.cpp')
-rw-r--r--src/net_processing.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/net_processing.cpp b/src/net_processing.cpp
index e4b8e9b6a9..5f47a9c16b 100644
--- a/src/net_processing.cpp
+++ b/src/net_processing.cpp
@@ -312,7 +312,7 @@ public:
/** Implement PeerManager */
void StartScheduledTasks(CScheduler& scheduler) override;
void CheckForStaleTipAndEvictPeers() override;
- bool FetchBlock(NodeId id, const uint256& hash, const CBlockIndex& index) override;
+ bool FetchBlock(NodeId id, const CBlockIndex& block_index) override;
bool GetNodeStateStats(NodeId nodeid, CNodeStateStats& stats) const override;
bool IgnoresIncomingTxs() override { return m_ignore_incoming_txs; }
void SendPings() override;
@@ -1428,7 +1428,7 @@ bool PeerManagerImpl::BlockRequestAllowed(const CBlockIndex* pindex)
(GetBlockProofEquivalentTime(*pindexBestHeader, *pindex, *pindexBestHeader, m_chainparams.GetConsensus()) < STALE_RELAY_AGE_LIMIT);
}
-bool PeerManagerImpl::FetchBlock(NodeId id, const uint256& hash, const CBlockIndex& index)
+bool PeerManagerImpl::FetchBlock(NodeId id, const CBlockIndex& block_index)
{
if (fImporting || fReindex) return false;
@@ -1440,9 +1440,10 @@ bool PeerManagerImpl::FetchBlock(NodeId id, const uint256& hash, const CBlockInd
if (!state->fHaveWitness) return false;
// Mark block as in-flight unless it already is
- if (!BlockRequested(id, index)) return false;
+ if (!BlockRequested(id, block_index)) return false;
// Construct message to request the block
+ const uint256& hash{block_index.GetBlockHash()};
std::vector<CInv> invs{CInv(MSG_BLOCK | MSG_WITNESS_FLAG, hash)};
// Send block request message to the peer