@@ -159,8 +159,6 @@ static constexpr size_t MAX_ADDR_TO_SEND{1000};
159
159
namespace {
160
160
/* * Blocks that are in flight, and that are in the queue to be downloaded. */
161
161
struct QueuedBlock {
162
- /* * Block hash */
163
- uint256 hash;
164
162
/* * BlockIndex. We must have this since we only request blocks when we've already validated the header. */
165
163
const CBlockIndex* pindex;
166
164
/* * Optional, used for CMPCTBLOCK downloads */
@@ -803,7 +801,7 @@ bool PeerManagerImpl::MarkBlockAsInFlight(NodeId nodeid, const CBlockIndex* pind
803
801
MarkBlockAsReceived (hash);
804
802
805
803
std::list<QueuedBlock>::iterator it = state->vBlocksInFlight .insert (state->vBlocksInFlight .end (),
806
- {hash, pindex, std::unique_ptr<PartiallyDownloadedBlock>(pit ? new PartiallyDownloadedBlock (&m_mempool) : nullptr )});
804
+ {pindex, std::unique_ptr<PartiallyDownloadedBlock>(pit ? new PartiallyDownloadedBlock (&m_mempool) : nullptr )});
807
805
state->nBlocksInFlight ++;
808
806
if (state->nBlocksInFlight == 1 ) {
809
807
// We're starting a block download (batch) from this peer.
@@ -1129,7 +1127,7 @@ void PeerManagerImpl::FinalizeNode(const CNode& node)
1129
1127
nSyncStarted--;
1130
1128
1131
1129
for (const QueuedBlock& entry : state->vBlocksInFlight ) {
1132
- mapBlocksInFlight.erase (entry.hash );
1130
+ mapBlocksInFlight.erase (entry.pindex -> GetBlockHash () );
1133
1131
}
1134
1132
WITH_LOCK (g_cs_orphans, m_orphanage.EraseForPeer (nodeid));
1135
1133
m_txrequest.DisconnectedPeer (nodeid);
@@ -4714,7 +4712,7 @@ bool PeerManagerImpl::SendMessages(CNode* pto)
4714
4712
QueuedBlock &queuedBlock = state.vBlocksInFlight .front ();
4715
4713
int nOtherPeersWithValidatedDownloads = m_peers_downloading_from - 1 ;
4716
4714
if (current_time > state.m_downloading_since + std::chrono::seconds{consensusParams.nPowTargetSpacing } * (BLOCK_DOWNLOAD_TIMEOUT_BASE + BLOCK_DOWNLOAD_TIMEOUT_PER_PEER * nOtherPeersWithValidatedDownloads)) {
4717
- LogPrintf (" Timeout downloading block %s from peer=%d, disconnecting\n " , queuedBlock.hash .ToString (), pto->GetId ());
4715
+ LogPrintf (" Timeout downloading block %s from peer=%d, disconnecting\n " , queuedBlock.pindex -> GetBlockHash () .ToString (), pto->GetId ());
4718
4716
pto->fDisconnect = true ;
4719
4717
return true ;
4720
4718
}
0 commit comments