Merge pull request #85 from lbryio/fix-utxosupply
fix custom configuration loading and gettxoutsetinfo request
This commit is contained in:
commit
a73d65b1c2
2 changed files with 8 additions and 10 deletions
|
@ -226,5 +226,4 @@ if (Configure::read('debug')) {
|
|||
Application::addPlugin('DebugKit', ['bootstrap' => true]);
|
||||
}
|
||||
|
||||
Configure::load('lbry','lbry.default');
|
||||
|
||||
Configure::load('lbry', 'default');
|
||||
|
|
|
@ -19,7 +19,7 @@ use Endroid\QrCode\Response\QrCodeResponse;
|
|||
|
||||
class MainController extends AppController {
|
||||
|
||||
public static $rpcurl;
|
||||
protected $rpcurl;
|
||||
|
||||
const lbcPriceKey = 'lbc.price';
|
||||
|
||||
|
@ -37,7 +37,7 @@ class MainController extends AppController {
|
|||
|
||||
public function initialize() {
|
||||
parent::initialize();
|
||||
self::$rpcurl = Configure::read('Lbry.RpcUrl');
|
||||
$this->rpcurl = Configure::read('Lbry.RpcUrl');
|
||||
$this->redis = new \Predis\Client(Configure::read('Redis.Url'));
|
||||
try {
|
||||
$this->redis->info('mem');
|
||||
|
@ -944,7 +944,7 @@ class MainController extends AppController {
|
|||
private function _gethashrate() {
|
||||
$req = ['method' => 'getnetworkhashps', 'params' => []];
|
||||
try {
|
||||
$res = json_decode(self::curl_json_post(self::$rpcurl, json_encode($req)));
|
||||
$res = json_decode(self::curl_json_post($this->rpcurl, json_encode($req)));
|
||||
if (!isset($res->result)) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -1009,16 +1009,15 @@ class MainController extends AppController {
|
|||
$cachedOutsetInfo = Cache::read('gettxoutsetinfo', 'api_requests');
|
||||
if ($cachedOutsetInfo !== false) {
|
||||
$res = json_decode($cachedOutsetInfo);
|
||||
if (!isset($res->result)) {
|
||||
return null;
|
||||
if (isset($res->result)) {
|
||||
return $res->result;
|
||||
}
|
||||
return $res->result;
|
||||
}
|
||||
|
||||
$req = ['method' => 'gettxoutsetinfo', 'params' => []];
|
||||
try {
|
||||
$response = self::curl_json_post(self::$rpcurl, json_encode($req));
|
||||
$res = json_decode($res);
|
||||
$response = self::curl_json_post($this->rpcurl, json_encode($req));
|
||||
$res = json_decode($response);
|
||||
if (!isset($res->result)) {
|
||||
return null;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue