[UPDATE] Also detect testnet on RPC > 0.16

This commit is contained in:
Sebastian Grewe 2018-05-12 23:20:50 +02:00 committed by GitHub
parent d1d4a07609
commit e79b558163
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -30,6 +30,15 @@ class BitcoinWrapper extends BitcoinClient {
return $this->memcache->setCache(__FUNCTION__, parent::getnetworkinfo()+parent::getmininginfo()+parent::getwalletinfo(), 30);
}
public function is_testnet() {
$this->oDebug->append("STA " . __METHOD__, 4);
if ($data = $this->memcache->get(__FUNCTION__)) return $data;
if (!(parent::getblockchaininfo()))
return $this->memcache->setCache(__FUNCTION__, parent::is_testnet(), 30);
else
return $this->memcache->setCache(__FUNCTION__, parent::getblockchaininfo()['chain'] == 'test', 30);
}
public function getmininginfo() {
$this->oDebug->append("STA " . __METHOD__, 4);
if ($data = $this->memcache->get(__FUNCTION__)) return $data;