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
<< " --password <password> Give a password for a private key." << 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
<< "Client transacting:" << 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;
string dbPath;
unsigned prime = 0;
bool yesIReallyKnowWhatImDoing = false;
/// File name for import/export.
string filename;
@ -425,6 +427,8 @@ int main(int argc, char** argv)
cerr << "Bad " << arg << " option: " << argv[i] << endl;
return -1;
}
else if (arg == "--yes-i-really-know-what-im-doing")
yesIReallyKnowWhatImDoing = true;
else if (arg == "--sentinel" && i + 1 < argc)
sentinel = argv[++i];
else if (arg == "--mine-on-wrong-chain")
@ -824,6 +828,7 @@ int main(int argc, char** argv)
return 0;
}
if (c_network == Network::Frontier && !yesIReallyKnowWhatImDoing)
{
auto pd = contents(getDataDir() + "primes");
unordered_set<unsigned> primes = RLP(pd).toUnorderedSet<unsigned>();

1
ethconsole/main.cpp

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

1
libethereum/BlockChain.cpp

@ -149,6 +149,7 @@ void BlockChain::open(std::string const& _path, WithExisting _we)
ldb::Options o;
o.create_if_missing = true;
o.max_open_files = 256;
ldb::DB::Open(o, path + "/blocks", &m_blocksDB);
ldb::DB::Open(o, path + "/details", &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<Session>> sessions;
auto const& ps = peerSessions();
allowed.reserve(ps.size());
for (auto const& j: ps)
size_t peerCount = 0;
foreachPeer([&](std::shared_ptr<EthereumPeer> _p)
{
auto pp = j.first->cap<EthereumPeer>();
if (_allow(pp.get()))
if (_allow(_p.get()))
{
allowed.push_back(move(pp));
sessions.push_back(move(j.first));
allowed.push_back(_p);
sessions.push_back(_p->session());
}
}
++peerCount;
return true;
});
chosen.reserve((ps.size() * _percent + 99) / 100);
for (unsigned i = (ps.size() * _percent + 99) / 100; i-- && allowed.size();)
chosen.reserve((peerCount * _percent + 99) / 100);
for (unsigned i = (peerCount * _percent + 99) / 100; i-- && allowed.size();)
{
unsigned n = rand() % allowed.size();
chosen.push_back(std::move(allowed[n]));

Loading…
Cancel
Save