mirror of
https://github.com/kvazar-network/kevacoin.git
synced 2025-02-04 11:14:16 +00:00
Increased block download timeout for RegTest as CN hashing is slower and take more time.
Fixed deserialization of cn header in python test framework.
This commit is contained in:
parent
dea50be56b
commit
f7b0fb0008
@ -3561,7 +3561,9 @@ bool PeerLogicValidation::SendMessages(CNode* pto, std::atomic<bool>& interruptM
|
||||
if (state.vBlocksInFlight.size() > 0) {
|
||||
QueuedBlock &queuedBlock = state.vBlocksInFlight.front();
|
||||
int nOtherPeersWithValidatedDownloads = nPeersWithValidatedDownloads - (state.nBlocksInFlightValidHeaders > 0);
|
||||
if (nNow > state.nDownloadingSince + consensusParams.nPowTargetSpacing * (BLOCK_DOWNLOAD_TIMEOUT_BASE + BLOCK_DOWNLOAD_TIMEOUT_PER_PEER * nOtherPeersWithValidatedDownloads)) {
|
||||
// Increase the block downloading timeout for RegTest, as Cryptonight hashing takes more time.
|
||||
int64_t powTargetSpacing = (consensusParams.nPowTargetSpacing == 20) ? 40 : consensusParams.nPowTargetSpacing;
|
||||
if (nNow > state.nDownloadingSince + powTargetSpacing * (BLOCK_DOWNLOAD_TIMEOUT_BASE + BLOCK_DOWNLOAD_TIMEOUT_PER_PEER * nOtherPeersWithValidatedDownloads)) {
|
||||
LogPrintf("Timeout downloading block %s from peer=%d, disconnecting\n", queuedBlock.hash.ToString(), pto->GetId());
|
||||
pto->fDisconnect = true;
|
||||
return true;
|
||||
|
@ -570,7 +570,8 @@ class CBlockHeader():
|
||||
self.nNonce = struct.unpack("<I", f.read(4))[0]
|
||||
|
||||
# Cryptonote header
|
||||
cnHeader = deser_string(f)
|
||||
# Skip the length value
|
||||
deser_compact_size(f)
|
||||
self.major_version = struct.unpack("<B", f.read(1))[0]
|
||||
self.minor_version = struct.unpack("<B", f.read(1))[0]
|
||||
self.timestamp = deser_varint(f)
|
||||
@ -637,7 +638,7 @@ class CBlockHeader():
|
||||
# self.sha256 stores the cn_fast hash.
|
||||
self.sha256 = uint256_from_str(pycryptonight.cn_fast_hash(c))
|
||||
self.hash = encode(pycryptonight.cn_fast_hash(c)[::-1], 'hex_codec').decode('ascii')
|
||||
# 4 is variant 4. nNonce is used to store block height.
|
||||
# nNonce is used to store block height.
|
||||
self.scrypt256 = uint256_from_str(pycryptonight.cn_slow_hash(c, self.major_version - 6, 0, self.nNonce))
|
||||
|
||||
def rehash(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user