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

Commit f74b3ed

Browse files
committed
Fix formatting
1 parent d255eb9 commit f74b3ed

File tree

2 files changed

+52
-40
lines changed

2 files changed

+52
-40
lines changed

eth/main.cpp

Lines changed: 45 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
/*
22
This file is part of cpp-ethereum.
3+
34
cpp-ethereum is free software: you can redistribute it and/or modify
45
it under the terms of the GNU General Public License as published by
56
the Free Software Foundation, either version 3 of the License, or
67
(at your option) any later version.
8+
79
cpp-ethereum is distributed in the hope that it will be useful,
810
but WITHOUT ANY WARRANTY; without even the implied warranty of
911
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1012
GNU General Public License for more details.
13+
1114
You should have received a copy of the GNU General Public License
1215
along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
1316
*/
@@ -74,7 +77,8 @@ string ethCredits(bool _interactive = false)
7477
{
7578
std::ostringstream cout;
7679
if (_interactive)
77-
cout << "Type 'exit' to quit\n\n";
80+
cout
81+
<< "Type 'exit' to quit\n\n";
7882
return credits() + cout.str();
7983
}
8084

@@ -94,6 +98,7 @@ to set locale to fail, so there are only two possible actions, the first is to
9498
throw a runtime exception and cause the program to quit (default behaviour),
9599
or the second is to modify the environment to something sensible (least
96100
surprising behaviour).
101+
97102
The follow code produces the least surprising behaviour. It will use the user
98103
specified default locale if it is valid, and if not then it will modify the
99104
environment the process is running in to use a sensible default. This also means
@@ -303,6 +308,7 @@ int main(int argc, char** argv)
303308
bool chainConfigIsSet = false;
304309
string configJSON;
305310
string genesisJSON;
311+
306312
po::options_description clientDefaultMode("Client mode (default)");
307313
clientDefaultMode.add_options()
308314
("format", po::value<string>(), "<binary/hex/human> Set format.")
@@ -332,18 +338,21 @@ int main(int argc, char** argv)
332338
("genesis", po::value<string>(), "Set genesisJSON")
333339
("genesis-json", po::value<string>(), "Set genesisJSON")
334340
("json-admin", po::value<string>(), "Set jsonAdmin");
341+
335342
po::options_description clientTransacting("Client transactions");
336343
clientTransacting.add_options()
337344
("ask", po::value<string>(), "See description under.")
338345
("bid", po::value<string>(), "See description under.")
339346
("unsafe-transactions", "Allow all transactions to proceed without verification. EXTREMELY UNSAFE.");
347+
340348
po::options_description clientMining("Client mining");
341349
clientMining.add_options()
342350
("address,a", po::value<string>(), "<addr> Set the author (mining payout) address to given address (default: auto).")
343351
("author", po::value<string>(), "<addr> Set the author (mining payout) address to given address (default: auto).")
344352
("mining,m", po::value<string>(), "<on/off/number> Enable mining, optionally for a specified number of blocks (default: off).")
345353
("cpu,C", "When mining, use the CPU.")
346354
("mining-threads,t", "<n> Limit number of CPU/GPU miners to n (default: use everything available on selected platform).");
355+
347356
po::options_description clientNetworking("Client networking");
348357
clientNetworking.add_options()
349358
("client-name", po::value<string>(), "<name> Add a name to your client's version string (default: blank).")
@@ -367,13 +376,15 @@ int main(int argc, char** argv)
367376
("pin", "Only accept or connect to trusted peers.")
368377
("hermit", "Equivalent to --no-discovery --pin.")
369378
("sociable", "Force discovery and no pinning.\n");
379+
370380
po::options_description importExportMode("Import/export mode");
371381
importExportMode.add_options()
372382
("from", po::value<string>(), "<n> Export only from block n; n may be a decimal, a '0x' prefixed hash, or 'latest'.")
373383
("to", po::value<string>(), "<n> Export only to block n (inclusive); n may be a decimal, a '0x' prefixed hash, or 'latest'.")
374384
("only", po::value<string>(), "<n> Equivalent to --export-from n --export-to n.")
375385
("dont-check", "Prevent checking some block aspects. Faster importing, but to apply only when the data is known to be valid.\n")
376386
("import-snapshot", po::value<string>(), "<path> Import blockchain and state data from the Parity Warp Sync snapshot.");
387+
377388
po::options_description generalOptions("General Options");
378389
generalOptions.add_options()
379390
("db-path,d", po::value<string>(), "See description under.")
@@ -385,11 +396,14 @@ int main(int argc, char** argv)
385396
("verbosity,v", po::value<int>(), "<0 - 9> Set the log verbosity from 0 to 9 (default: 8).")
386397
("version,V", "Show the version and exit.")
387398
("help,h", "Show this help message and exit.\n");
399+
388400
po::options_description experimentalProofOfConcept("Experimental / Proof of Concept");
389401
experimentalProofOfConcept.add_options()
390402
("shh", "Enable Whisper.\n");
403+
391404
po::options_description allowedOptions("Allowed options");
392405
allowedOptions.add(clientDefaultMode).add(clientTransacting).add(clientMining).add(clientNetworking).add(importExportMode).add(generalOptions);
406+
393407
po::variables_map vm;
394408
vector<string> unrecognisedOptions;
395409
try
@@ -877,7 +891,7 @@ int main(int argc, char** argv)
877891
{
878892
cerr << "provided genesis block description is not well formatted\n";
879893
string genesisSample =
880-
R"E(
894+
R"E(
881895
{
882896
"nonce": "0x0000000000000042",
883897
"difficulty": "0x400000000",
@@ -1014,10 +1028,10 @@ int main(int argc, char** argv)
10141028
bytes block = web3.ethereum()->blockChain().block(web3.ethereum()->blockChain().numberHash(i));
10151029
switch (exportFormat)
10161030
{
1017-
case Format::Binary: out.write((char const*)block.data(), block.size()); break;
1018-
case Format::Hex: out << toHex(block) << "\n"; break;
1019-
case Format::Human: out << RLP(block) << "\n"; break;
1020-
default:;
1031+
case Format::Binary: out.write((char const*)block.data(), block.size()); break;
1032+
case Format::Hex: out << toHex(block) << "\n"; break;
1033+
case Format::Human: out << RLP(block) << "\n"; break;
1034+
default:;
10211035
}
10221036
}
10231037
return 0;
@@ -1045,12 +1059,12 @@ int main(int argc, char** argv)
10451059

10461060
switch (web3.ethereum()->queueBlock(block, safeImport))
10471061
{
1048-
case ImportResult::Success: good++; break;
1049-
case ImportResult::AlreadyKnown: alreadyHave++; break;
1050-
case ImportResult::UnknownParent: unknownParent++; break;
1051-
case ImportResult::FutureTimeUnknown: unknownParent++; futureTime++; break;
1052-
case ImportResult::FutureTimeKnown: futureTime++; break;
1053-
default: bad++; break;
1062+
case ImportResult::Success: good++; break;
1063+
case ImportResult::AlreadyKnown: alreadyHave++; break;
1064+
case ImportResult::UnknownParent: unknownParent++; break;
1065+
case ImportResult::FutureTimeUnknown: unknownParent++; futureTime++; break;
1066+
case ImportResult::FutureTimeKnown: futureTime++; break;
1067+
default: bad++; break;
10541068
}
10551069

10561070
// sync chain with queue
@@ -1185,14 +1199,14 @@ int main(int argc, char** argv)
11851199
return true;
11861200

11871201
string r = getResponse(_t.userReadable(isProxy,
1188-
[&](TransactionSkeleton const& _t) -> pair<bool, string>
1189-
{
1190-
h256 contractCodeHash = web3.ethereum()->postState().codeHash(_t.to);
1191-
if (contractCodeHash == EmptySHA3)
1192-
return std::make_pair(false, std::string());
1193-
// TODO: actually figure out the natspec. we'll need the natspec database here though.
1194-
return std::make_pair(true, std::string());
1195-
}, [&](Address const& _a) { return _a.hex(); }
1202+
[&](TransactionSkeleton const& _t) -> pair<bool, string>
1203+
{
1204+
h256 contractCodeHash = web3.ethereum()->postState().codeHash(_t.to);
1205+
if (contractCodeHash == EmptySHA3)
1206+
return std::make_pair(false, std::string());
1207+
// TODO: actually figure out the natspec. we'll need the natspec database here though.
1208+
return std::make_pair(true, std::string());
1209+
}, [&](Address const& _a) { return _a.hex(); }
11961210
) + "\nEnter yes/no/always (always to this address): ", {"yes", "n", "N", "no", "NO", "always"});
11971211
if (r == "always")
11981212
allowedDestinations.insert(_t.to);
@@ -1217,21 +1231,17 @@ int main(int argc, char** argv)
12171231
if (testingMode)
12181232
testEth = new rpc::Test(*web3.ethereum());
12191233

1220-
if (ipc)
1221-
{
1222-
jsonrpcIpcServer.reset(new FullServer(
1223-
ethFace, new rpc::Whisper(web3, {}), new rpc::Net(web3),
1224-
new rpc::Web3(web3.clientVersion()), new rpc::Personal(keyManager, *accountHolder, *web3.ethereum()),
1225-
new rpc::AdminEth(*web3.ethereum(), *gasPricer.get(), keyManager, *sessionManager.get()),
1226-
new rpc::AdminNet(web3, *sessionManager.get()),
1227-
new rpc::AdminUtils(*sessionManager.get()),
1228-
new rpc::Debug(*web3.ethereum()),
1229-
testEth
1230-
));
1231-
auto ipcConnector = new IpcServer("geth");
1232-
jsonrpcIpcServer->addConnector(ipcConnector);
1233-
ipcConnector->StartListening();
1234-
}
1234+
jsonrpcIpcServer.reset(new FullServer(
1235+
ethFace, new rpc::Net(web3),
1236+
new rpc::Web3(web3.clientVersion()), new rpc::Personal(keyManager, *accountHolder, *web3.ethereum()),
1237+
new rpc::AdminEth(*web3.ethereum(), *gasPricer.get(), keyManager, *sessionManager.get()),
1238+
new rpc::AdminNet(web3, *sessionManager.get()),
1239+
new rpc::Debug(*web3.ethereum()),
1240+
testEth
1241+
));
1242+
auto ipcConnector = new IpcServer("geth");
1243+
jsonrpcIpcServer->addConnector(ipcConnector);
1244+
ipcConnector->StartListening();
12351245

12361246
if (jsonAdmin.empty())
12371247
jsonAdmin = sessionManager->newSession(rpc::SessionPermissions{{rpc::Privilege::Admin}});

ethkey/main.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/*
22
This file is part of cpp-ethereum.
3+
34
cpp-ethereum is free software: you can redistribute it and/or modify
45
it under the terms of the GNU General Public License as published by
56
the Free Software Foundation, either version 3 of the License, or
@@ -8,6 +9,7 @@
89
but WITHOUT ANY WARRANTY; without even the implied warranty of
910
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1011
GNU General Public License for more details.
12+
1113
You should have received a copy of the GNU General Public License
1214
along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
1315
*/
@@ -69,9 +71,9 @@ int main(int argc, char** argv)
6971
g_logVerbosity = 0;
7072
po::options_description generalOptions("General Options");
7173
generalOptions.add_options()
72-
("verbosity,v", po::value<int>(), "<0 - 9> Set the log verbosity from 0 to 9 (default: 8).")
73-
("version,V", "Show the version and exit.")
74-
("help,h", "Show this help message and exit.");
74+
("verbosity,v", po::value<int>(), "<0 - 9> Set the log verbosity from 0 to 9 (default: 8).")
75+
("version,V", "Show the version and exit.")
76+
("help,h", "Show this help message and exit.");
7577
po::parsed_options parsed = po::command_line_parser(argc, argv).options(generalOptions).allow_unregistered().run();
7678
vector<string> unrecognisedOptions = collect_unrecognized(parsed.options, po::include_positional);
7779
for (size_t i = 0; i < unrecognisedOptions.size(); ++i)
@@ -91,8 +93,8 @@ int main(int argc, char** argv)
9193
if (vm.count("help"))
9294
{
9395
cout
94-
<< "Usage ethkey [OPTIONS]" << endl
95-
<< "Options:" << endl << endl;
96+
<< "Usage ethkey [OPTIONS]" << endl
97+
<< "Options:" << endl << endl;
9698
KeyCLI::streamHelp(cout);
9799
cout << generalOptions;
98100
exit(0);

0 commit comments

Comments
 (0)