From 52d13987e5b6cc87b7262d1e8790d92385420c20 Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Wed, 8 Jan 2020 22:02:03 +0100 Subject: [PATCH 1/2] fix custom configuration loading and gettxoutsetinfo request --- config/bootstrap.php | 3 +-- src/Controller/MainController.php | 15 +++++++-------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/config/bootstrap.php b/config/bootstrap.php index 756de4d..871b6f8 100644 --- a/config/bootstrap.php +++ b/config/bootstrap.php @@ -226,5 +226,4 @@ if (Configure::read('debug')) { Application::addPlugin('DebugKit', ['bootstrap' => true]); } -Configure::load('lbry','lbry.default'); - +Configure::load('lbry', 'default'); diff --git a/src/Controller/MainController.php b/src/Controller/MainController.php index 29660ea..3e7ec77 100644 --- a/src/Controller/MainController.php +++ b/src/Controller/MainController.php @@ -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'); @@ -943,7 +943,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; } @@ -1008,16 +1008,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; } -- 2.45.2 From bb595d002772fddf2333c4f7c62b76f8a4b79e01 Mon Sep 17 00:00:00 2001 From: Thomas Zarebczan Date: Thu, 27 Feb 2020 18:22:34 -0500 Subject: [PATCH 2/2] update LBRY addresses --- src/Controller/MainController.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Controller/MainController.php b/src/Controller/MainController.php index 29660ea..2d1cb07 100644 --- a/src/Controller/MainController.php +++ b/src/Controller/MainController.php @@ -451,7 +451,7 @@ class MainController extends AppController { } } - $lbryAddresses = ['rFLUohPG4tP3gZHYoyhvADCtrDMiaYb7Qd', 'r9PGXsejVJb9ZfMf3QVdDEJCzxkd9JLxzL', 'r9srwX7DEN7Mex3a8oR1mKSqQmLBizoJvi', 'bRo4FEeqqxY7nWFANsZsuKEWByEgkvz8Qt', 'bU2XUzckfpdEuQNemKvhPT1gexQ3GG3SC2', 'bay3VA6YTQBL4WLobbG7CthmoGeUKXuXkD', 'bLPbiXBp6Vr3NSnsHzDsLNzoy5o36re9Cz', 'bVUrbCK8hcZ5XWti7b9eNxKEBxzc1rr393', 'bZja2VyhAC84a9hMwT8dwTU6rDRXowrjxH', 'bMgqQqYfwzWWYBk5o5dBMXtCndVAoeqy6h', 'bMvUBo1h5WS46ThHtmfmXftz3z33VHL7wc']; + $lbryAddresses = ['rEqocTgdPdoD8NEbrECTUPfpquJ4zPVCJ8', 'rKaAUDxr24hHNNTQuNtRvNt8SGYJMdLXo3', 'r7hj61jdbGXcsccxw8UmEFCReZoCWLRr7t', 'bRo4FEeqqxY7nWFANsZsuKEWByEgkvz8Qt', 'bU2XUzckfpdEuQNemKvhPT1gexQ3GG3SC2', 'bay3VA6YTQBL4WLobbG7CthmoGeUKXuXkD', 'bLPbiXBp6Vr3NSnsHzDsLNzoy5o36re9Cz', 'bVUrbCK8hcZ5XWti7b9eNxKEBxzc1rr393', 'bZja2VyhAC84a9hMwT8dwTU6rDRXowrjxH', 'bMgqQqYfwzWWYBk5o5dBMXtCndVAoeqy6h', 'bMvUBo1h5WS46ThHtmfmXftz3z33VHL7wc', 'bX6napXtY2nVTBRc8PwULBuGWn2i3SCtrN']; $totalBalance = 0; $maxBalance = 0; $minBalance = 0; @@ -887,7 +887,8 @@ class MainController extends AppController { 'bVUrbCK8hcZ5XWti7b9eNxKEBxzc1rr393', 'bZja2VyhAC84a9hMwT8dwTU6rDRXowrjxH', 'bCrboXVztuSbZzVToCWSsu1pEr2oxKHu9v', - 'bMgqQqYfwzWWYBk5o5dBMXtCndVAoeqy6h' + 'bMgqQqYfwzWWYBk5o5dBMXtCndVAoeqy6h', + 'bX6napXtY2nVTBRc8PwULBuGWn2i3SCtrN' ]; $allAddresses = array_merge($reservedcommunity, $reservedoperational, $reservedinstitutional, $reservedaux); -- 2.45.2