Browse Source

update inspect cmd, whitespace cleanup

cl-refactor
caktux 11 years ago
parent
commit
e653d2e61e
  1. 15
      eth/main.cpp
  2. 17
      neth/main.cpp

15
eth/main.cpp

@ -588,17 +588,26 @@ int main(int argc, char** argv)
ClientGuard g(&c); ClientGuard g(&c);
auto h = h160(fromHex(rechex)); auto h = h160(fromHex(rechex));
stringstream s; stringstream s;
auto mem = c.state().storage(h);
for (auto const& i: mem) try
{
auto storage = c.state().storage(h);
for (auto const& i: storage)
s << "@" << showbase << hex << i.first << " " << showbase << hex << i.second << endl; s << "@" << showbase << hex << i.first << " " << showbase << hex << i.second << endl;
s << endl << disassemble(c.state().code(h)); s << endl << disassemble(c.state().code(h)) << endl;
string outFile = getDataDir() + "/" + rechex + ".evm"; string outFile = getDataDir() + "/" + rechex + ".evm";
ofstream ofs; ofstream ofs;
ofs.open(outFile, ofstream::binary); ofs.open(outFile, ofstream::binary);
ofs.write(s.str().c_str(), s.str().length()); ofs.write(s.str().c_str(), s.str().length());
ofs.close(); ofs.close();
cnote << "Saved" << rechex << "to" << outFile;
}
catch (eth::InvalidTrie)
{
cwarn << "Corrupted trie.";
}
} }
} }
else if (cmd == "setSecret") else if (cmd == "setSecret")

17
neth/main.cpp

@ -151,7 +151,7 @@ void version()
exit(0); exit(0);
} }
Address c_config = Address("9ef0f0d81e040012600b0c1abdef7c48f720f88a"); Address c_config = Address("661005d2720d855f1d9976f88bb10c1a3398c77f");
string pretty(h160 _a, eth::State _st) string pretty(h160 _a, eth::State _st)
{ {
string ns; string ns;
@ -808,17 +808,26 @@ int main(int argc, char** argv)
ClientGuard g(&c); ClientGuard g(&c);
auto h = h160(fromHex(rechex)); auto h = h160(fromHex(rechex));
stringstream s; stringstream s;
auto mem = c.state().storage(h);
for (auto const& i: mem) try
{
auto storage = c.state().storage(h);
for (auto const& i: storage)
s << "@" << showbase << hex << i.first << " " << showbase << hex << i.second << endl; s << "@" << showbase << hex << i.first << " " << showbase << hex << i.second << endl;
s << endl << disassemble(c.state().code(h)); s << endl << disassemble(c.state().code(h)) << endl;
string outFile = getDataDir() + "/" + rechex + ".evm"; string outFile = getDataDir() + "/" + rechex + ".evm";
ofstream ofs; ofstream ofs;
ofs.open(outFile, ofstream::binary); ofs.open(outFile, ofstream::binary);
ofs.write(s.str().c_str(), s.str().length()); ofs.write(s.str().c_str(), s.str().length());
ofs.close(); ofs.close();
cnote << "Saved" << rechex << "to" << outFile;
}
catch (eth::InvalidTrie)
{
cwarn << "Corrupted trie.";
}
} }
} }
else if (cmd == "reset") else if (cmd == "reset")

Loading…
Cancel
Save