Skip to content

Commit

Permalink
Add client name to debug screen
Browse files Browse the repository at this point in the history
  • Loading branch information
leto committed Jun 25, 2019
1 parent 6fe9311 commit e5066a0
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -1159,6 +1159,28 @@
</widget>
</item>

<item row="15" column="0">
<widget class="QLabel" name="clientnamelabel">
<property name="text">
<string>Client Name</string>
</property>
</widget>
</item>
<item row="15" column="2">
<widget class="QLabel" name="clientname">
<property name="text">
<string>Loading...</string>
</property>
</widget>
</item>
<item row="15" column="1">
<widget class="QLabel" name="clientnamespacer">
<property name="text">
<string>|</string>
</property>
</widget>
</item>

<item row="3" column="2">
<widget class="QLabel" name="solrate">
<property name="text">
Expand Down
14 changes: 14 additions & 0 deletions src/rpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,19 @@ void RPC::getInfoThenRefresh(bool force) {
ui->solrate->setText(QString::number(solrate) % " Sol/s");
});

// Get network info
payload = {
{"jsonrpc", "1.0"},
{"id", "someid"},
{"method", "getnetworkinfo"}
};

conn->doRPCIgnoreError(payload, [=](const json& reply) {
QString clientname = QString::fromStdString( reply["subversion"].get<json::string_t>() );

ui->clientname->setText(clientname);
});

// Call to see if the blockchain is syncing.
payload = {
{"jsonrpc", "1.0"},
Expand All @@ -621,6 +634,7 @@ void RPC::getInfoThenRefresh(bool force) {

conn->doRPCIgnoreError(payload, [=](const json& reply) {
auto progress = reply["verificationprogress"].get<double>();
// TODO: use getinfo.synced
bool isSyncing = progress < 0.9999; // 99.99%
int blockNumber = reply["blocks"].get<json::number_unsigned_t>();

Expand Down

0 comments on commit e5066a0

Please sign in to comment.