mirror of
https://github.com/kvazar-network/kevacoin.git
synced 2025-02-04 11:14:16 +00:00
Fixed RegTest download timeout.
This commit is contained in:
parent
991678d552
commit
0b30d4911c
@ -284,8 +284,8 @@ public:
|
||||
consensus.BIP65Height = 1351; // BIP65 activated on regtest (Used in rpc activation tests)
|
||||
consensus.BIP66Height = 1251; // BIP66 activated on regtest (Used in rpc activation tests)
|
||||
consensus.powLimit = uint256S("7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
|
||||
consensus.nPowTargetTimespan = 20; // 20 second
|
||||
consensus.nPowTargetSpacing = 20; // 20 second
|
||||
consensus.nPowTargetTimespan = 2.0 * 60; // Two minutes
|
||||
consensus.nPowTargetSpacing = 2.0 * 60; // Two minutes
|
||||
consensus.fPowAllowMinDifficultyBlocks = true;
|
||||
consensus.fPowNoRetargeting = true;
|
||||
consensus.nRuleChangeActivationThreshold = 108; // 75% for testchains
|
||||
|
@ -3561,9 +3561,7 @@ 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);
|
||||
// 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)) {
|
||||
if (nNow > state.nDownloadingSince + consensusParams.nPowTargetSpacing * (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;
|
||||
|
@ -300,6 +300,24 @@ UniValue CN_JSONRPCError(int code, const std::string& message)
|
||||
|
||||
// NOTE: Assumes a conclusive result; if result is inconclusive, it must be handled by caller
|
||||
static UniValue BIP22ValidationResult(const CValidationState& state)
|
||||
{
|
||||
if (state.IsValid())
|
||||
return NullUniValue;
|
||||
|
||||
std::string strRejectReason = state.GetRejectReason();
|
||||
if (state.IsError())
|
||||
throw JSONRPCError(RPC_VERIFY_ERROR, strRejectReason);
|
||||
if (state.IsInvalid())
|
||||
{
|
||||
if (strRejectReason.empty())
|
||||
return "rejected";
|
||||
return strRejectReason;
|
||||
}
|
||||
// Should be impossible
|
||||
return "valid?";
|
||||
}
|
||||
|
||||
static UniValue BIP22ValidationResult_CN(const CValidationState& state)
|
||||
{
|
||||
if (state.IsValid()) {
|
||||
UniValue result(UniValue::VOBJ);
|
||||
@ -1194,7 +1212,7 @@ UniValue submitblock(const JSONRPCRequest& request)
|
||||
if (!sc.found) {
|
||||
throw CN_JSONRPCError(CORE_RPC_ERROR_CODE_BLOCK_NOT_ACCEPTED, "inconclusive");
|
||||
}
|
||||
return BIP22ValidationResult(sc.state);
|
||||
return BIP22ValidationResult_CN(sc.state);
|
||||
}
|
||||
|
||||
UniValue estimatefee(const JSONRPCRequest& request)
|
||||
|
Loading…
x
Reference in New Issue
Block a user