Browse Source

Merge pull request #272 from caktux/develop

force mining for eth/neth, get actual balance instead of pending, fix clang warnings
cl-refactor
Gav Wood 11 years ago
parent
commit
0f22df60b8
  1. 2
      alethzero/MainWin.cpp
  2. 12
      eth/main.cpp
  3. 2
      libethereum/State.cpp
  4. 15
      neth/main.cpp

2
alethzero/MainWin.cpp

@ -1683,7 +1683,7 @@ QString Main::prettyU256(eth::u256 _n) const
s << "<span style=\"color: #008\">" << (uint64_t)_n << "</span> <span style=\"color: #448\">(0x" << hex << (uint64_t)_n << ")</span>";
else if (!~(_n >> 64))
s << "<span style=\"color: #008\">" << (int64_t)_n << "</span> <span style=\"color: #448\">(0x" << hex << (int64_t)_n << ")</span>";
else if (_n >> 200 == 0)
else if ((_n >> 200) == 0)
{
Address a = right160(_n);
QString n = pretty(a);

12
eth/main.cpp

@ -295,7 +295,11 @@ int main(int argc, char** argv)
if (!clientName.empty())
clientName += "/";
Client c("Ethereum(++)/" + clientName + "v" + eth::EthVersion + "/" ETH_QUOTED(ETH_BUILD_TYPE) "/" ETH_QUOTED(ETH_BUILD_PLATFORM), coinbase, dbPath);
Client c("Ethereum(++)/" + clientName + "v" + eth::EthVersion + "/" ETH_QUOTED(ETH_BUILD_TYPE) "/" ETH_QUOTED(ETH_BUILD_PLATFORM), coinbase, dbPath);
c.setForceMining(true);
cout << credits();
c.setForceMining(forceMining);
@ -425,7 +429,7 @@ int main(int argc, char** argv)
}
else if (cmd == "balance")
{
cout << "Current balance: " << formatBalance(c.balanceAt(us.address(), 0)) << " = " << c.balanceAt(us.address(), 0) << " wei" << endl;
cout << "Current balance: " << formatBalance(c.balanceAt(us.address())) << " = " << c.balanceAt(us.address()) << " wei" << endl;
}
else if (cmd == "transact")
{
@ -487,7 +491,7 @@ int main(int argc, char** argv)
for (auto const& i: acs)
if (c.codeAt(i, 0).size())
{
ss = toString(i) + " : " + toString(c.balanceAt(i, 0)) + " [" + toString((unsigned)c.countAt(i)) + "]";
ss = toString(i) + " : " + toString(c.balanceAt(i)) + " [" + toString((unsigned)c.countAt(i)) + "]";
cout << ss << endl;
}
}
@ -498,7 +502,7 @@ int main(int argc, char** argv)
for (auto const& i: acs)
if (c.codeAt(i, 0).empty())
{
ss = toString(i) + " : " + toString(c.balanceAt(i, 0)) + " [" + toString((unsigned)c.countAt(i)) + "]";
ss = toString(i) + " : " + toString(c.balanceAt(i)) + " [" + toString((unsigned)c.countAt(i)) + "]";
cout << ss << endl;
}
}

2
libethereum/State.cpp

@ -1227,10 +1227,12 @@ std::ostream& eth::operator<<(std::ostream& _out, State const& _s)
}
if (cache)
for (auto const& j: cache->storage())
{
if ((!mem.count(j.first) && j.second) || (mem.count(j.first) && mem.at(j.first) != j.second))
mem[j.first] = j.second, delta.insert(j.first);
else if (j.second)
cached.insert(j.first);
}
if (delta.size())
lead = (lead == " . ") ? "*.* " : "*** ";

15
neth/main.cpp

@ -411,7 +411,11 @@ int main(int argc, char** argv)
if (!clientName.empty())
clientName += "/";
Client c("NEthereum(++)/" + clientName + "v" + eth::EthVersion + "/" ETH_QUOTED(ETH_BUILD_TYPE) "/" ETH_QUOTED(ETH_BUILD_PLATFORM), coinbase, dbPath);
Client c("NEthereum(++)/" + clientName + "v" + eth::EthVersion + "/" ETH_QUOTED(ETH_BUILD_TYPE) "/" ETH_QUOTED(ETH_BUILD_PLATFORM), coinbase, dbPath);
c.setForceMining(true);
cout << credits();
std::ostringstream ccout;
@ -591,7 +595,7 @@ int main(int argc, char** argv)
}
else if (cmd == "balance")
{
u256 balance = c.balanceAt(us.address(), 0);
u256 balance = c.balanceAt(us.address());
ccout << "Current balance:" << endl;
ccout << toString(balance) << endl;
}
@ -899,7 +903,7 @@ int main(int argc, char** argv)
auto s = boost::format("%1%%2% : %3% [%4%]") %
toString(i) %
pretty(i, c.postState()) %
toString(formatBalance(c.balanceAt(i, 0))) %
toString(formatBalance(c.balanceAt(i))) %
toString((unsigned)c.countAt(i, 0));
mvwaddnstr(contractswin, cc++, x, s.str().c_str(), qwidth);
if (cc > qheight - 2)
@ -911,12 +915,13 @@ int main(int argc, char** argv)
auto s = boost::format("%1%%2% : %3% [%4%]") %
toString(i) %
pretty(i, c.postState()) %
toString(formatBalance(c.balanceAt(i, 0))) %
toString(formatBalance(c.balanceAt(i))) %
toString((unsigned)c.countAt(i, 0));
mvwaddnstr(addswin, y++, x, s.str().c_str(), width / 2 - 4);
if (y > height * 3 / 5 - 4)
break;
}
// Peers
y = 1;
for (PeerInfo const& i: c.peers())
@ -941,7 +946,7 @@ int main(int argc, char** argv)
// Balance
stringstream ssb;
u256 balance = c.balanceAt(us.address(), 0);
u256 balance = c.balanceAt(us.address());
Address coinsAddr = right160(c.stateAt(c_config, 1));
Address gavCoin = right160(c.stateAt(coinsAddr, c.stateAt(coinsAddr, 1)));
u256 totalGavCoinBalance = c.stateAt(gavCoin, (u160)us.address());

Loading…
Cancel
Save