diff --git a/CMakeLists.txt b/CMakeLists.txt index ddbbfe5ce..62ed5d6d3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,7 @@ set(CMAKE_AUTOMOC ON) cmake_policy(SET CMP0015 NEW) -set(ETH_VERSION 0.1.1) +set(ETH_VERSION 0.1.2) set(ETH_BUILD_TYPE ${CMAKE_BUILD_TYPE}) set(ETH_BUILD_PLATFORM ${CMAKE_SYSTEM_NAME}) if (CMAKE_COMPILER_IS_MINGW) diff --git a/alethzero/Main.ui b/alethzero/Main.ui index 331155559..540d51146 100644 --- a/alethzero/Main.ui +++ b/alethzero/Main.ui @@ -139,44 +139,77 @@ 2 - - - 4 - + 0 - - - QFrame::NoFrame + + + Qt::Vertical + + + QFrame::NoFrame + + + + + + + + Listen on + + + + + + + 1 + + + 5 + + + + + + + Ideal Peers + + + + + + + 1024 + + + 32767 + + + 30303 + + + + + + + Client Name + + + + + + + Anonymous + + + + + - - - - - - Listen on - - - - - - - 1024 - - - 32767 - - - 30303 - - - - - diff --git a/alethzero/MainWin.cpp b/alethzero/MainWin.cpp index 351f4b77f..913501747 100644 --- a/alethzero/MainWin.cpp +++ b/alethzero/MainWin.cpp @@ -25,7 +25,7 @@ Main::Main(QWidget *parent) : setWindowFlags(Qt::Window); ui->setupUi(this); g_logPost = [=](std::string const& s, char const*) { ui->log->addItem(QString::fromStdString(s)); }; - m_client = new Client("AlethZero/v" ADD_QUOTES(ETH_VERSION) "/" ADD_QUOTES(ETH_BUILD_TYPE) "/" ADD_QUOTES(ETH_BUILD_PLATFORM)); + m_client = new Client("AlethZero"); readSettings(); refresh(); @@ -171,6 +171,12 @@ void Main::refresh() m_client->unlock(); } +void Main::on_idealPeers_valueChanged() +{ + if (m_client->peerServer()) + m_client->peerServer()->setIdealPeerCount(ui->idealPeers->value()); +} + void Main::on_ourAccounts_doubleClicked() { qApp->clipboard()->setText(ui->ourAccounts->currentItem()->text().section(" @ ", 1)); @@ -234,8 +240,14 @@ void Main::updateFee() void Main::on_net_triggered() { ui->port->setEnabled(!ui->net->isChecked()); + ui->clientName->setEnabled(!ui->net->isChecked()); + string n = "AlethZero/v" ADD_QUOTES(ETH_VERSION); + if (ui->clientName->text().size()) + n += "/" + ui->clientName->text().toStdString(); + n += "/" ADD_QUOTES(ETH_BUILD_TYPE) "/" ADD_QUOTES(ETH_BUILD_PLATFORM); + m_client->setClientVersion(n); if (ui->net->isChecked()) - m_client->startNetwork(ui->port->value(), string(), 0, NodeMode::Full, 5, std::string(), ui->upnp->isChecked()); + m_client->startNetwork(ui->port->value(), string(), 0, NodeMode::Full, ui->idealPeers->value(), std::string(), ui->upnp->isChecked()); else m_client->stopNetwork(); } diff --git a/alethzero/MainWin.h b/alethzero/MainWin.h index 016e00274..7f9cd16cf 100644 --- a/alethzero/MainWin.h +++ b/alethzero/MainWin.h @@ -34,6 +34,7 @@ private slots: void on_accounts_doubleClicked(); void on_destination_textChanged(); void on_data_textChanged(); + void on_idealPeers_valueChanged(); void on_value_valueChanged() { updateFee(); } void on_valueUnits_currentIndexChanged() { updateFee(); } void on_log_doubleClicked(); diff --git a/eth/main.cpp b/eth/main.cpp index 2bd7f865a..6c3b4bed7 100644 --- a/eth/main.cpp +++ b/eth/main.cpp @@ -32,6 +32,9 @@ using namespace std; using namespace eth; +#define ADD_QUOTES_HELPER(s) #s +#define ADD_QUOTES(s) ADD_QUOTES_HELPER(s) + bytes contents(std::string const& _file) { std::ifstream is(_file, std::ifstream::binary); @@ -165,7 +168,7 @@ int main(int argc, char** argv) remoteHost = argv[i]; } - Client c("Ethereum(++)/v0.1", coinbase, dbPath); + Client c("Ethereum(++)/v" ADD_QUOTES(ETH_VERSION) "/" ADD_QUOTES(ETH_BUILD_TYPE) "/" ADD_QUOTES(ETH_BUILD_PLATFORM), coinbase, dbPath); if (interactive) { cout << "Ethereum (++)" << endl; diff --git a/libethereum/Client.h b/libethereum/Client.h index 70b94d84b..1ef75c9f5 100644 --- a/libethereum/Client.h +++ b/libethereum/Client.h @@ -96,6 +96,8 @@ public: /// Get the object representing the transaction queue. TransactionQueue const& transactionQueue() const { return m_tq; } + void setClientVersion(std::string const& _name) { m_clientVersion = _name; } + // Network stuff: /// Get information on the current peer set. @@ -109,6 +111,8 @@ public: void connect(std::string const& _seedHost, short _port = 30303); /// Stop the network subsystem. void stopNetwork(); + /// Get access to the peer server object. This will be null if the network isn't online. + PeerServer* peerServer() const { return m_net; } // Mining stuff: