From e79b558163ba8eafe1964f5199f09cde74a5ebc2 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Sat, 12 May 2018 23:20:50 +0200 Subject: [PATCH] [UPDATE] Also detect testnet on RPC > 0.16 --- include/classes/bitcoinwrapper.class.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/classes/bitcoinwrapper.class.php b/include/classes/bitcoinwrapper.class.php index 63729002..1f6f9a5e 100755 --- a/include/classes/bitcoinwrapper.class.php +++ b/include/classes/bitcoinwrapper.class.php @@ -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;