Changeset View
Changeset View
Standalone View
Standalone View
src/avalanche/postconsensus.cpp
- This file was added.
// Copyright (c) 2022 The Bitcoin developers | |||||
// Distributed under the MIT software license, see the accompanying | |||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | |||||
#include <avalanche/postconsensus.h> | |||||
#include <chainparams.h> | |||||
#include <util/system.h> | |||||
namespace avalanche { | |||||
bool isEarlyBlockPenaltyEnabled(const ArgsManager &argsman) { | |||||
return argsman.GetBoolArg("-avapolicyearlyblockpenalty", | |||||
EARLY_BLOCK_PENALTY_DEFAULT_ENABLED); | |||||
} | |||||
int64_t getEarlyBlockPenaltyFactor(const ArgsManager &argsman, | |||||
const CChainParams &chainparams) { | |||||
if (chainparams.IsTestChain() && | |||||
!argsman.IsArgSet("-avapolicyearlyblockpenaltyfactor")) { | |||||
// Test chains apply no penalty by default | |||||
return 1; | |||||
} | |||||
return argsman.GetIntArg("-avapolicyearlyblockpenaltyfactor", | |||||
EARLY_BLOCK_PENALTY_FACTOR_DEFAULT); | |||||
} | |||||
int64_t getEarlyBlockPenaltyWindow(const ArgsManager &argsman, | |||||
const CChainParams &chainparams) { | |||||
if (chainparams.IsTestChain() && | |||||
!argsman.IsArgSet("-avapolicyearlyblockpenaltywindow")) { | |||||
// Test chains apply no penalty by default | |||||
return 0; | |||||
} | |||||
return argsman.GetIntArg("-avapolicyearlyblockpenaltywindow", | |||||
EARLY_BLOCK_PENALTY_WINDOW_DEFAULT); | |||||
} | |||||
} // namespace avalanche |