aboutsummaryrefslogtreecommitdiff
path: root/src/net_processing.cpp
diff options
context:
space:
mode:
authorShibe <[email protected]>2021-02-08 04:54:51 +0400
committerShibe <[email protected]>2021-02-08 16:52:55 +0400
commitef9242b9ec46a28690e49debe2c2364bb70be702 (patch)
treeb012eaa7e97e3ae70d99027ec5e31f3d08febc20 /src/net_processing.cpp
parentMerge pull request #1705 from rnicoll/block-download-timeout (diff)
downloaddiscoin-ef9242b9ec46a28690e49debe2c2364bb70be702.tar.xz
discoin-ef9242b9ec46a28690e49debe2c2364bb70be702.zip
Don't re-check AuxPoW when sending data to peers
Checking scrypt PoW is expensive and needless in this case. All block headers are already checked when they are accepted, and they will be checked again on the receiving end.
Diffstat (limited to 'src/net_processing.cpp')
-rw-r--r--src/net_processing.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/net_processing.cpp b/src/net_processing.cpp
index 1a918f486..1b33d529b 100644
--- a/src/net_processing.cpp
+++ b/src/net_processing.cpp
@@ -1037,7 +1037,7 @@ void static ProcessGetData(CNode* pfrom, const Consensus::Params& consensusParam
{
// Send block from disk
CBlock block;
- if (!ReadBlockFromDisk(block, (*mi).second, consensusParams))
+ if (!ReadBlockFromDisk(block, (*mi).second, consensusParams, false))
assert(!"cannot load block from disk");
if (inv.type == MSG_BLOCK)
connman.PushMessage(pfrom, msgMaker.Make(SERIALIZE_TRANSACTION_NO_WITNESS, NetMsgType::BLOCK, block));
@@ -1705,7 +1705,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
}
CBlock block;
- bool ret = ReadBlockFromDisk(block, it->second, chainparams.GetConsensus(it->second->nHeight));
+ bool ret = ReadBlockFromDisk(block, it->second, chainparams.GetConsensus(it->second->nHeight), false);
assert(ret);
SendBlockTransactions(block, req, pfrom, connman);
@@ -1748,7 +1748,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
LogPrint("net", "getheaders %d to %s from peer=%d\n", (pindex ? pindex->nHeight : -1), hashStop.IsNull() ? "end" : hashStop.ToString(), pfrom->id);
for (; pindex; pindex = chainActive.Next(pindex))
{
- vHeaders.push_back(pindex->GetBlockHeader(chainparams.GetConsensus(pindex->nHeight)));
+ vHeaders.push_back(pindex->GetBlockHeader(chainparams.GetConsensus(pindex->nHeight), false));
if (--nLimit <= 0 || pindex->GetBlockHash() == hashStop)
break;
}
@@ -2974,14 +2974,14 @@ bool SendMessages(CNode* pto, CConnman& connman, const std::atomic<bool>& interr
pBestIndex = pindex;
if (fFoundStartingHeader) {
// add this to the headers message
- vHeaders.push_back(pindex->GetBlockHeader(consensusParams));
+ vHeaders.push_back(pindex->GetBlockHeader(consensusParams, false));
} else if (PeerHasHeader(&state, pindex)) {
continue; // keep looking for the first new block
} else if (pindex->pprev == NULL || PeerHasHeader(&state, pindex->pprev)) {
// Peer doesn't have this header but they do have the prior one.
// Start sending headers.
fFoundStartingHeader = true;
- vHeaders.push_back(pindex->GetBlockHeader(consensusParams));
+ vHeaders.push_back(pindex->GetBlockHeader(consensusParams, false));
} else {
// Peer doesn't have this header or the prior one -- nothing will
// connect, so bail out.
@@ -3014,7 +3014,7 @@ bool SendMessages(CNode* pto, CConnman& connman, const std::atomic<bool>& interr
}
if (!fGotBlockFromCache) {
CBlock block;
- bool ret = ReadBlockFromDisk(block, pBestIndex, consensusParams);
+ bool ret = ReadBlockFromDisk(block, pBestIndex, consensusParams, false);
assert(ret);
CBlockHeaderAndShortTxIDs cmpctblock(block, state.fWantsCmpctWitness);
connman.PushMessage(pto, msgMaker.Make(nSendFlags, NetMsgType::CMPCTBLOCK, cmpctblock));