[UDPDATE] Put chain download into wrapper class
This commit is contained in:
parent
2c3052be24
commit
b4ae900137
@ -66,6 +66,19 @@ class BitcoinWrapper extends BitcoinClient {
|
|||||||
$dDifficulty = $this->getdifficulty();
|
$dDifficulty = $this->getdifficulty();
|
||||||
return $this->memcache->setCache(__FUNCTION__, $dDifficulty * pow(2,32) / $iCurrentPoolHashrate, 30);
|
return $this->memcache->setCache(__FUNCTION__, $dDifficulty * pow(2,32) / $iCurrentPoolHashrate, 30);
|
||||||
}
|
}
|
||||||
|
public function getblockchaindownload() {
|
||||||
|
$aPeerInfo = $this->getpeerinfo();
|
||||||
|
$aInfo = $this->getinfo();
|
||||||
|
$iStartingHeight = 0;
|
||||||
|
foreach ($aPeerInfo as $aPeerData) {
|
||||||
|
if ($iStartingHeight < $aPeerData['startingheight']) $iStartingHeight = $aPeerData['startingheight'];
|
||||||
|
}
|
||||||
|
if ($iStartingHeight > $aInfo['blocks']) {
|
||||||
|
return number_format(round($aInfo['blocks'] / $iStartingHeight * 100, 2), 2);
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
public function getnetworkhashps() {
|
public function getnetworkhashps() {
|
||||||
$this->oDebug->append("STA " . __METHOD__, 4);
|
$this->oDebug->append("STA " . __METHOD__, 4);
|
||||||
if ($data = $this->memcache->get(__FUNCTION__)) return $data;
|
if ($data = $this->memcache->get(__FUNCTION__)) return $data;
|
||||||
|
|||||||
@ -24,14 +24,7 @@ if (!$smarty->isCached('master.tpl', $smarty_cache_key)) {
|
|||||||
$aGetInfo = $bitcoin->getinfo();
|
$aGetInfo = $bitcoin->getinfo();
|
||||||
$aGetPeerInfo = $bitcoin->getpeerinfo();
|
$aGetPeerInfo = $bitcoin->getpeerinfo();
|
||||||
# Check if daemon is downloading the blockchain, estimated
|
# Check if daemon is downloading the blockchain, estimated
|
||||||
$iStartingHeight = 0;
|
if ($dDownloadPercentage = $bitcoin->getblockchaindownload()) $aGetInfo['errors'] = "Downloading: $dDownloadPercentage%";
|
||||||
foreach ($aGetPeerInfo as $aPeerData) {
|
|
||||||
if ($iStartingHeight < $aPeerData['startingheight']) $iStartingHeight = $aPeerData['startingheight'];
|
|
||||||
}
|
|
||||||
if ($iStartingHeight > $aGetInfo['blocks']) {
|
|
||||||
$dDownloadPercentage = number_format(round($aGetInfo['blocks'] / $iStartingHeight * 100, 2), 2);
|
|
||||||
$aGetInfo['errors'] = "Downloading: $dDownloadPercentage%";
|
|
||||||
}
|
|
||||||
$aGetTransactions = $bitcoin->listtransactions('', (int)$setting->getValue('wallet_transaction_limit', 25));
|
$aGetTransactions = $bitcoin->listtransactions('', (int)$setting->getValue('wallet_transaction_limit', 25));
|
||||||
if (is_array($aGetInfo) && array_key_exists('newmint', $aGetInfo)) {
|
if (is_array($aGetInfo) && array_key_exists('newmint', $aGetInfo)) {
|
||||||
$dNewmint = $aGetInfo['newmint'];
|
$dNewmint = $aGetInfo['newmint'];
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user