Skip to content
This repository has been archived by the owner on Oct 28, 2021. It is now read-only.

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
winsvega committed Jul 25, 2018
1 parent 3da26a1 commit 73ba70b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
3 changes: 2 additions & 1 deletion libethcore/ChainOperationParams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ EVMSchedule const& ChainOperationParams::scheduleForBlockNumber(u256 const& _blo

u256 ChainOperationParams::blockReward(EVMSchedule const& _schedule) const
{
if (_schedule.blockRewardOverwrite)
return 0;
if (_schedule.blockRewardOverwrite)
return *_schedule.blockRewardOverwrite;
else
return m_blockReward;
Expand Down
4 changes: 2 additions & 2 deletions libethcore/ChainOperationParams.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@ struct ChainOperationParams

/// General chain params.
private:
u256 m_blockReward;
u256 m_blockReward = 5000000000000000000;
public:
EVMSchedule const& scheduleForBlockNumber(u256 const& _blockNumber) const;
u256 blockReward(EVMSchedule const& _schedule) const;
void setBlockReward(u256 const& _newBlockReward);
u256 maximumExtraDataSize = 1024;
u256 maximumExtraDataSize = 32;
u256 accountStartNonce = 0;
bool tieBreakingGas = true;
u256 minGasLimit;
Expand Down
15 changes: 11 additions & 4 deletions libethereum/ChainParams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,20 @@ ChainParams ChainParams::loadConfig(
js::mObject obj = val.get_obj();

validateConfigJson(obj);
cp.sealEngineName = obj[c_sealEngine].get_str();

// params
cp.sealEngineName = obj[c_sealEngine].get_str();
js::mObject params = obj[c_params].get_obj();
cp.accountStartNonce = u256(fromBigEndian<u256>(fromHex(params[c_accountStartNonce].get_str())));
cp.maximumExtraDataSize = u256(fromBigEndian<u256>(fromHex(params[c_maximumExtraDataSize].get_str())));

// Params that are not required and could be set to default value
if (params.count(c_accountStartNonce))
cp.accountStartNonce = u256(fromBigEndian<u256>(fromHex(params[c_accountStartNonce].get_str())));
if (params.count(c_maximumExtraDataSize))
cp.maximumExtraDataSize = u256(fromBigEndian<u256>(fromHex(params[c_maximumExtraDataSize].get_str())));

cp.tieBreakingGas = params.count(c_tieBreakingGas) ? params[c_tieBreakingGas].get_bool() : true;
cp.setBlockReward(u256(fromBigEndian<u256>(fromHex(params[c_blockReward].get_str()))));
if (params.count(c_blockReward))
cp.setBlockReward(u256(fromBigEndian<u256>(fromHex(params[c_blockReward].get_str()))));

auto setOptionalU256Parameter = [&params](u256 &_destination, string const& _name)
{
Expand Down

0 comments on commit 73ba70b

Please sign in to comment.