diff --git a/src/controller.cpp b/src/controller.cpp index 83de33c..76e6e9e 100644 --- a/src/controller.cpp +++ b/src/controller.cpp @@ -298,14 +298,16 @@ void Controller::getInfoThenRefresh(bool force) static bool prevCallSucceeded = false; zrpc->fetchInfo([=] (const json& reply) { - prevCallSucceeded = true; - int curBlock = reply["latest_block_height"].get(); - bool doUpdate = force || (model->getLatestBlock() != curBlock); - int difficulty = reply["difficulty"].get(); - int blocks_until_halving= 340000 - curBlock; - int halving_days = (blocks_until_halving * 150) / (60 * 60 * 24) ; - int longestchain = reply["longestchain"].get(); - int notarized = reply["notarized"].get(); + prevCallSucceeded = true; + int curBlock = reply["latest_block_height"].get(); + bool doUpdate = force || (model->getLatestBlock() != curBlock); + int difficulty = reply["difficulty"].get(); + int num_halvings = 1; // number of halvings that have occured already + int blocks_until_halving = (num_halvings*1680000 + 340000) - curBlock; + int blocktime = 75; + int halving_days = (blocks_until_halving * blocktime) / (60 * 60 * 24) ; + int longestchain = reply["longestchain"].get(); + int notarized = reply["notarized"].get(); model->setLatestBlock(curBlock); if ( @@ -330,9 +332,7 @@ void Controller::getInfoThenRefresh(bool force) (QLocale(QLocale::German).toString(blocks_until_halving)) + " Blocks or , " + (QLocale(QLocale::German).toString(halving_days) + " days" ) ); - } - else - { + } else { ui->blockHeight->setText( "Block: " + QLocale(QLocale::English).toString(curBlock) );