Make rewards in regtest mode less random

This allows sane testing. Regtest mode is primarily intended for automated
testing, so this simplification makes sense
This commit is contained in:
Jannis Froese 2014-06-02 21:31:23 +02:00
parent 72bfa77114
commit 8826b6bdc4
3 changed files with 4 additions and 2 deletions

View file

@ -262,6 +262,7 @@ public:
} }
virtual bool RequireRPCPassword() const { return false; } virtual bool RequireRPCPassword() const { return false; }
virtual bool SimplifiedRewards() const { return true; }
virtual Network NetworkID() const { return CChainParams::REGTEST; } virtual Network NetworkID() const { return CChainParams::REGTEST; }
}; };
static CRegTestParams regTestParams; static CRegTestParams regTestParams;

View file

@ -60,6 +60,7 @@ public:
int SubsidyHalvingInterval() const { return nSubsidyHalvingInterval; } int SubsidyHalvingInterval() const { return nSubsidyHalvingInterval; }
virtual const CBlock& GenesisBlock() const = 0; virtual const CBlock& GenesisBlock() const = 0;
virtual bool RequireRPCPassword() const { return true; } virtual bool RequireRPCPassword() const { return true; }
virtual bool SimplifiedRewards() const { return false; }
const string& DataDir() const { return strDataDir; } const string& DataDir() const { return strDataDir; }
virtual Network NetworkID() const = 0; virtual Network NetworkID() const = 0;
const vector<CDNSSeedData>& DNSSeeds() const { return vSeeds; } const vector<CDNSSeedData>& DNSSeeds() const { return vSeeds; }

View file

@ -1196,11 +1196,11 @@ int64_t GetBlockValue(int nHeight, int64_t nFees, uint256 prevHash)
int rand = generateMTRandom(seed, 999999); int rand = generateMTRandom(seed, 999999);
int rand1 = 0; int rand1 = 0;
if(nHeight < 100000) if(nHeight < 100000 && !Params().SimplifiedRewards())
{ {
nSubsidy = (1 + rand) * COIN; nSubsidy = (1 + rand) * COIN;
} }
else if(nHeight < 145000) else if(nHeight < 145000 && !Params().SimplifiedRewards())
{ {
cseed_str = prevHash.ToString().substr(7,7); cseed_str = prevHash.ToString().substr(7,7);
cseed = cseed_str.c_str(); cseed = cseed_str.c_str();