Browse Source

Add client name to debug screen

pull/45/head
Duke Leto 5 years ago
parent
commit
e5066a03fc
  1. 22
      src/mainwindow.ui
  2. 14
      src/rpc.cpp

22
src/mainwindow.ui

@ -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">

14
src/rpc.cpp

@ -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"},
@ -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>();

Loading…
Cancel
Save