Browse Source

style

cl-refactor
CJentzsch 10 years ago
parent
commit
d968959ad0
  1. 6
      eth/main.cpp
  2. 14
      libethereum/Client.cpp
  3. 6
      neth/main.cpp

6
eth/main.cpp

@ -1141,7 +1141,7 @@ int main(int argc, char** argv)
{
gasPricer->setRefBlockFees(u256(blockFees * 1000));
}
catch(Overflow const& _e)
catch (Overflow const& _e)
{
cout << boost::diagnostic_information(_e);
}
@ -1152,14 +1152,14 @@ int main(int argc, char** argv)
{
iss >> etherPrice;
if (etherPrice == 0)
cout << "ether price can not be set to zero" << endl;
cout << "ether price cannot be set to zero" << endl;
else
{
try
{
gasPricer->setRefPrice(u256(double(ether / 1000) / etherPrice));
}
catch(Overflow const& _e)
catch (Overflow const& _e)
{
cout << boost::diagnostic_information(_e);
}

14
libethereum/Client.cpp

@ -82,8 +82,8 @@ void BasicGasPricer::update(BlockChain const& _bc)
h256 p = _bc.currentHash();
m_gasPerBlock = _bc.info(p).gasLimit;
map<u256, unsigned> dist;
unsigned total = 0;
map<u256, u256> dist;
u256 total = 0;
// make gasPrice versus gasUsed distribution for the last 1000 blocks
while (c < 1000 && p)
@ -98,9 +98,9 @@ void BasicGasPricer::update(BlockChain const& _bc)
for (auto const& tr: r[1])
{
Transaction tx(tr.data(), CheckTransaction::None);
auto gu = brs.receipts[i].gasUsed();
dist[tx.gasPrice()] += (unsigned)gu;
total += (unsigned)gu;
u256 gu = brs.receipts[i].gasUsed();
dist[tx.gasPrice()] += gu;
total += gu;
i++;
}
}
@ -129,8 +129,8 @@ void BasicGasPricer::update(BlockChain const& _bc)
// calc octiles normalized to gaussian distribution
boost::math::normal gauss(4, normalizedSd ? normalizedSd : 1);
for (int i=1; i < 8; i++)
m_octiles[i] = mean / 4000 * int(boost::math::quantile(gauss, (double)i / 8) * 1000);
for (int i = 1; i < 8; i++)
m_octiles[i] = mean / 4000 * int(boost::math::quantile(gauss, i / 8.0) * 1000);
m_octiles[8] = dist.rbegin()->first;
}

6
neth/main.cpp

@ -722,7 +722,7 @@ int main(int argc, char** argv)
{
gasPricer->setRefBlockFees(u256(blockFees * 1000));
}
catch(Overflow const& _e)
catch (Overflow const& _e)
{
cout << boost::diagnostic_information(_e);
}
@ -733,14 +733,14 @@ int main(int argc, char** argv)
{
iss >> etherPrice;
if (etherPrice == 0)
cout << "ether price can not be set to zero" << endl;
cout << "ether price cannot be set to zero" << endl;
else
{
try
{
gasPricer->setRefPrice(u256(double(ether / 1000) / etherPrice));
}
catch(Overflow const& _e)
catch (Overflow const& _e)
{
cout << boost::diagnostic_information(_e);
}

Loading…
Cancel
Save