Browse Source

Update gas limit modulation.

cl-refactor
subtly 10 years ago
parent
commit
9357e47a83
  1. 5
      libethcore/BlockInfo.cpp
  2. 3
      libwhisper/WhisperPeer.cpp

5
libethcore/BlockInfo.cpp

@ -228,7 +228,10 @@ u256 BlockInfo::selectGasLimit(BlockInfo const& _parent) const
return c_genesisGasLimit;
else
// target minimum of 3141592
return max<u256>(max<u256>(c_minGasLimit, 3141592), _parent.gasLimit - _parent.gasLimit / c_gasLimitBoundDivisor + 1 + (_parent.gasUsed * 6 / 5) / c_gasLimitBoundDivisor);
if (_parent.gasLimit < c_genesisGasLimit)
return min<u256>(c_genesisGasLimit, _parent.gasLimit + _parent.gasLimit / c_gasLimitBoundDivisor - 1);
else
return max<u256>(c_genesisGasLimit, _parent.gasLimit - _parent.gasLimit / c_gasLimitBoundDivisor + 1 + (_parent.gasUsed * 6 / 5) / c_gasLimitBoundDivisor);
}
u256 BlockInfo::calculateDifficulty(BlockInfo const& _parent) const

3
libwhisper/WhisperPeer.cpp

@ -68,8 +68,7 @@ bool WhisperPeer::interpret(unsigned _id, RLP const& _r)
{
unsigned n = 0;
for (auto i: _r)
if (n++)
host()->inject(Envelope(i), this);
host()->inject(Envelope(i), this);
break;
}
default:

Loading…
Cancel
Save