Skip to content

Commit

Permalink
First attempt to add support to BTC >= 0.16
Browse files Browse the repository at this point in the history
  • Loading branch information
lubuzzo committed Apr 17, 2018
1 parent 8fa8d6c commit 26d2915
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 3 additions & 1 deletion include/classes/bitcoin.class.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -284,13 +284,15 @@ public function __construct($scheme, $username, $password, $address = "localhost
* The check is done by calling the server's getinfo() method and checking
* for a fault.
*
* To turn code compatible with BTC >= 0.16, getmininginfo() method used instead of getinfo()
*
* @return mixed boolean TRUE if successful, or a fault string otherwise
* @access public
* @throws none
*/
public function can_connect() {
try {
$r = $this->getinfo();
$r = $this->getmininginfo();
} catch (Exception $e) {
return $e->getMessage();
}
Expand Down
7 changes: 6 additions & 1 deletion include/classes/bitcoinwrapper.class.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,18 @@ public function __construct($type, $username, $password, $host, $debug_level, $d
public function getinfo() {
$this->oDebug->append("STA " . __METHOD__, 4);
if ($data = $this->memcache->get(__FUNCTION__)) return $data;
return $this->memcache->setCache(__FUNCTION__, parent::getinfo(), 30);
if (!(parent::getwalletinfo()['walletname']))
return $this->memcache->setCache(__FUNCTION__, parent::getinfo(), 30);
else
return $this->memcache->setCache(__FUNCTION__, parent::getnetworkinfo()+parent::getmininginfo()+parent::getwalletinfo(), 30);
}

public function getmininginfo() {
$this->oDebug->append("STA " . __METHOD__, 4);
if ($data = $this->memcache->get(__FUNCTION__)) return $data;
return $this->memcache->setCache(__FUNCTION__, parent::getmininginfo(), 30);
}

public function getblockcount() {
$this->oDebug->append("STA " . __METHOD__, 4);
if ($data = $this->memcache->get(__FUNCTION__)) return $data;
Expand Down

0 comments on commit 26d2915

Please sign in to comment.