Browse Source

Merge branch 'develop' of github.com:ethereum/cpp-ethereum into develop

Conflicts:
	ethconsole/main.cpp
cl-refactor
Gav Wood 9 years ago
parent
commit
b3f2a14551
  1. 5
      eth/main.cpp
  2. 1
      ethconsole/main.cpp
  3. 1
      libethereum/BlockChain.cpp
  4. 20
      libethereum/EthereumHost.cpp

5
eth/main.cpp

@ -141,6 +141,7 @@ void help()
<< " --master <password> Give the master password for the key store." << endl << " --master <password> Give the master password for the key store." << endl
<< " --password <password> Give a password for a private key." << endl << " --password <password> Give a password for a private key." << endl
<< " --sentinel <server> Set the sentinel for reporting bad blocks or chain issues." << endl << " --sentinel <server> Set the sentinel for reporting bad blocks or chain issues." << endl
<< " --prime <n> Specify n as the 6 digit prime number to start Frontier." << endl
<< endl << endl
<< "Client transacting:" << endl << "Client transacting:" << endl
/*<< " -B,--block-fees <n> Set the block fee profit in the reference unit e.g. ¢ (default: 15)." << endl /*<< " -B,--block-fees <n> Set the block fee profit in the reference unit e.g. ¢ (default: 15)." << endl
@ -292,6 +293,7 @@ int main(int argc, char** argv)
OperationMode mode = OperationMode::Node; OperationMode mode = OperationMode::Node;
string dbPath; string dbPath;
unsigned prime = 0; unsigned prime = 0;
bool yesIReallyKnowWhatImDoing = false;
/// File name for import/export. /// File name for import/export.
string filename; string filename;
@ -425,6 +427,8 @@ int main(int argc, char** argv)
cerr << "Bad " << arg << " option: " << argv[i] << endl; cerr << "Bad " << arg << " option: " << argv[i] << endl;
return -1; return -1;
} }
else if (arg == "--yes-i-really-know-what-im-doing")
yesIReallyKnowWhatImDoing = true;
else if (arg == "--sentinel" && i + 1 < argc) else if (arg == "--sentinel" && i + 1 < argc)
sentinel = argv[++i]; sentinel = argv[++i];
else if (arg == "--mine-on-wrong-chain") else if (arg == "--mine-on-wrong-chain")
@ -824,6 +828,7 @@ int main(int argc, char** argv)
return 0; return 0;
} }
if (c_network == Network::Frontier && !yesIReallyKnowWhatImDoing)
{ {
auto pd = contents(getDataDir() + "primes"); auto pd = contents(getDataDir() + "primes");
unordered_set<unsigned> primes = RLP(pd).toUnorderedSet<unsigned>(); unordered_set<unsigned> primes = RLP(pd).toUnorderedSet<unsigned>();

1
ethconsole/main.cpp

@ -21,7 +21,6 @@
#include <string> #include <string>
#include <libjsconsole/JSRemoteConsole.h> #include <libjsconsole/JSRemoteConsole.h>
using namespace std; using namespace std;
using namespace dev; using namespace dev;
using namespace dev::eth; using namespace dev::eth;

1
libethereum/BlockChain.cpp

@ -149,6 +149,7 @@ void BlockChain::open(std::string const& _path, WithExisting _we)
ldb::Options o; ldb::Options o;
o.create_if_missing = true; o.create_if_missing = true;
o.max_open_files = 256;
ldb::DB::Open(o, path + "/blocks", &m_blocksDB); ldb::DB::Open(o, path + "/blocks", &m_blocksDB);
ldb::DB::Open(o, path + "/details", &m_extrasDB); ldb::DB::Open(o, path + "/details", &m_extrasDB);
if (!m_blocksDB || !m_extrasDB) if (!m_blocksDB || !m_extrasDB)

20
libethereum/EthereumHost.cpp

@ -166,20 +166,20 @@ tuple<vector<shared_ptr<EthereumPeer>>, vector<shared_ptr<EthereumPeer>>, vector
vector<shared_ptr<EthereumPeer>> allowed; vector<shared_ptr<EthereumPeer>> allowed;
vector<shared_ptr<Session>> sessions; vector<shared_ptr<Session>> sessions;
auto const& ps = peerSessions(); size_t peerCount = 0;
allowed.reserve(ps.size()); foreachPeer([&](std::shared_ptr<EthereumPeer> _p)
for (auto const& j: ps)
{ {
auto pp = j.first->cap<EthereumPeer>(); if (_allow(_p.get()))
if (_allow(pp.get()))
{ {
allowed.push_back(move(pp)); allowed.push_back(_p);
sessions.push_back(move(j.first)); sessions.push_back(_p->session());
} }
} ++peerCount;
return true;
});
chosen.reserve((ps.size() * _percent + 99) / 100); chosen.reserve((peerCount * _percent + 99) / 100);
for (unsigned i = (ps.size() * _percent + 99) / 100; i-- && allowed.size();) for (unsigned i = (peerCount * _percent + 99) / 100; i-- && allowed.size();)
{ {
unsigned n = rand() % allowed.size(); unsigned n = rand() % allowed.size();
chosen.push_back(std::move(allowed[n])); chosen.push_back(std::move(allowed[n]));

Loading…
Cancel
Save