Skip to content

Commit

Permalink
Add next halving info to debug screen
Browse files Browse the repository at this point in the history
  • Loading branch information
leto committed Jun 26, 2019
1 parent 49bb939 commit 1fc94b6
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 3 deletions.
22 changes: 22 additions & 0 deletions src/mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -1181,6 +1181,28 @@
</widget>
</item>

<item row="16" column="0">
<widget class="QLabel" name="halvinglabel">
<property name="text">
<string>Next Halving</string>
</property>
</widget>
</item>
<item row="16" column="2">
<widget class="QLabel" name="halving">
<property name="text">
<string>Loading...</string>
</property>
</widget>
</item>
<item row="16" column="1">
<widget class="QLabel" name="halvingspacer">
<property name="text">
<string>|</string>
</property>
</widget>
</item>

<item row="3" column="2">
<widget class="QLabel" name="solrate">
<property name="text">
Expand Down
10 changes: 7 additions & 3 deletions src/rpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,9 @@ void RPC::getInfoThenRefresh(bool force) {
int notarized = reply["notarized"].get<json::number_integer_t>();
int protocolversion = reply["protocolversion"].get<json::number_integer_t>();
int lag = curBlock - notarized;
int blocks_until_halving= 340000 - curBlock;
char halving_days[8];
sprintf(halving_days, "%.2f", (double) (blocks_until_halving * 150) / (60*60*24) );
QString ntzhash = QString::fromStdString( reply["notarizedhash"].get<json::string_t>() );
QString ntztxid = QString::fromStdString( reply["notarizedtxid"].get<json::string_t>() );
QString kmdver = QString::fromStdString( reply["KMDversion"].get<json::string_t>() );
Expand All @@ -571,11 +574,12 @@ void RPC::getInfoThenRefresh(bool force) {
ui->notarizedhashvalue->setText( ntzhash );
ui->notarizedtxidvalue->setText( ntztxid );
ui->lagvalue->setText( QString::number(lag) );
ui->version->setText( QString::number(version) );
ui->version->setText( QString::number(version) );
ui->kmdversion->setText( kmdver );
ui->protocolversion->setText( QString::number(protocolversion) );
ui->p2pport->setText( QString::number(p2pport) );
ui->rpcport->setText( QString::number(rpcport) );
ui->p2pport->setText( QString::number(p2pport) );
ui->rpcport->setText( QString::number(rpcport) );
ui->halving->setText( QString::number(blocks_until_halving) % " blocks, " % QString::fromStdString(halving_days) % " days" );

if ( force || (curBlock != lastBlock) ) {
// Something changed, so refresh everything.
Expand Down

0 comments on commit 1fc94b6

Please sign in to comment.