Skip to content

Commit 6baa532

Browse files
committed
updating changes to live for block sync issue
1 parent 3776322 commit 6baa532

File tree

3 files changed

+20
-19
lines changed

3 files changed

+20
-19
lines changed

src/chain.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ CBlockHeader CBlockIndex::GetBlockHeader(const node::BlockManager& blockman) con
2525
have to read the actual *header*, not the full block. */
2626
if (block.IsAuxpow())
2727
{
28-
blockman.ReadBlockHeader(block, *this);
29-
return block;
28+
CBlock fullblock;
29+
blockman.ReadBlock(fullblock, *this);
30+
return fullblock.GetBlockHeader();
3031
}
3132

3233
if (pprev)

src/net_processing.cpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4698,28 +4698,28 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
46984698

46994699
std::vector<CBlockHeader> headers;
47004700

4701-
// // Bypass the normal CBlock deserialization, as we don't want to risk deserializing 2000 full blocks.
4702-
// unsigned int nCount = ReadCompactSize(vRecv);
4703-
// if (nCount > m_opts.max_headers_result) {
4704-
// Misbehaving(*peer, strprintf("headers message size = %u", nCount));
4705-
// return;
4706-
// }
4707-
// headers.resize(nCount);
4708-
// for (unsigned int n = 0; n < nCount; n++) {
4709-
// vRecv >> headers[n];
4710-
// ReadCompactSize(vRecv); // ignore tx count; assume it is 0.
4711-
// }
4701+
// Bypass the normal CBlock deserialization, as we don't want to risk deserializing 2000 full blocks.
4702+
unsigned int nCount = ReadCompactSize(vRecv);
4703+
if (nCount > m_opts.max_headers_result) {
4704+
Misbehaving(*peer, strprintf("headers message size = %u", nCount));
4705+
return;
4706+
}
4707+
headers.resize(nCount);
4708+
for (unsigned int n = 0; n < nCount; n++) {
4709+
vRecv >> headers[n];
4710+
ReadCompactSize(vRecv); // ignore tx count; assume it is 0.
4711+
}
47124712

47134713
LogPrintf("testing vRecv >> headers \n");
47144714

4715-
vRecv >> headers;
4715+
// vRecv >> headers;
47164716

47174717
LogPrintf("testing 123 vRecv >> headers \n");
47184718

4719-
for (size_t i = 0; i < headers.size(); i++)
4720-
{
4721-
LogPrintf("testing 124 hash >> headers %s \n", headers[i].GetHash().ToString());
4722-
}
4719+
// for (size_t i = 0; i < headers.size(); i++)
4720+
// {
4721+
// LogPrintf("testing 124 hash >> headers %s \n", headers[i].GetHash().ToString());
4722+
// }
47234723

47244724

47254725
ProcessHeadersMessage(pfrom, *peer, std::move(headers), /*via_compact_block=*/false);

src/net_processing.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ static const bool DEFAULT_PEERBLOCKFILTERS = false;
4545
static const unsigned int MAX_CMPCTBLOCKS_INFLIGHT_PER_BLOCK = 3;
4646
/** Number of headers sent in one getheaders result. We rely on the assumption that if a peer sends
4747
* less than this number, we reached its tip. Changing this value is a protocol upgrade. */
48-
static const unsigned int MAX_HEADERS_RESULTS = 2000;
48+
static const unsigned int MAX_HEADERS_RESULTS = 20;
4949

5050
struct CNodeStateStats {
5151
int nSyncHeight = -1;

0 commit comments

Comments
 (0)