Skip to content

Commit e79b558

Browse files
authored
[UPDATE] Also detect testnet on RPC > 0.16
1 parent d1d4a07 commit e79b558

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Diff for: include/classes/bitcoinwrapper.class.php

+9
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,15 @@ public function getinfo() {
3030
return $this->memcache->setCache(__FUNCTION__, parent::getnetworkinfo()+parent::getmininginfo()+parent::getwalletinfo(), 30);
3131
}
3232

33+
public function is_testnet() {
34+
$this->oDebug->append("STA " . __METHOD__, 4);
35+
if ($data = $this->memcache->get(__FUNCTION__)) return $data;
36+
if (!(parent::getblockchaininfo()))
37+
return $this->memcache->setCache(__FUNCTION__, parent::is_testnet(), 30);
38+
else
39+
return $this->memcache->setCache(__FUNCTION__, parent::getblockchaininfo()['chain'] == 'test', 30);
40+
}
41+
3342
public function getmininginfo() {
3443
$this->oDebug->append("STA " . __METHOD__, 4);
3544
if ($data = $this->memcache->get(__FUNCTION__)) return $data;

0 commit comments

Comments
 (0)