Skip to content

Commit 26d2915

Browse files
committed
First attempt to add support to BTC >= 0.16
1 parent 8fa8d6c commit 26d2915

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

include/classes/bitcoin.class.php

100644100755
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,13 +284,15 @@ public function __construct($scheme, $username, $password, $address = "localhost
284284
* The check is done by calling the server's getinfo() method and checking
285285
* for a fault.
286286
*
287+
* To turn code compatible with BTC >= 0.16, getmininginfo() method used instead of getinfo()
288+
*
287289
* @return mixed boolean TRUE if successful, or a fault string otherwise
288290
* @access public
289291
* @throws none
290292
*/
291293
public function can_connect() {
292294
try {
293-
$r = $this->getinfo();
295+
$r = $this->getmininginfo();
294296
} catch (Exception $e) {
295297
return $e->getMessage();
296298
}

include/classes/bitcoinwrapper.class.php

100644100755
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,18 @@ public function __construct($type, $username, $password, $host, $debug_level, $d
2424
public function getinfo() {
2525
$this->oDebug->append("STA " . __METHOD__, 4);
2626
if ($data = $this->memcache->get(__FUNCTION__)) return $data;
27-
return $this->memcache->setCache(__FUNCTION__, parent::getinfo(), 30);
27+
if (!(parent::getwalletinfo()['walletname']))
28+
return $this->memcache->setCache(__FUNCTION__, parent::getinfo(), 30);
29+
else
30+
return $this->memcache->setCache(__FUNCTION__, parent::getnetworkinfo()+parent::getmininginfo()+parent::getwalletinfo(), 30);
2831
}
32+
2933
public function getmininginfo() {
3034
$this->oDebug->append("STA " . __METHOD__, 4);
3135
if ($data = $this->memcache->get(__FUNCTION__)) return $data;
3236
return $this->memcache->setCache(__FUNCTION__, parent::getmininginfo(), 30);
3337
}
38+
3439
public function getblockcount() {
3540
$this->oDebug->append("STA " . __METHOD__, 4);
3641
if ($data = $this->memcache->get(__FUNCTION__)) return $data;

0 commit comments

Comments
 (0)