Fix command

This commit is contained in:
Ben van Hartingsveldt 2025-05-25 20:27:12 +02:00
parent 3a6e10b467
commit c4f68fef07
No known key found for this signature in database
GPG key ID: 261AA214130CE7AB

View file

@ -1,28 +1,28 @@
<?php <?php
namespace App\Console\Commands; namespace App\Console\Commands;
use DateTime;
use DateTimeZone;
use Exception;
use InvalidArgumentException;
use PDO;
use RedisException;
use Throwable;
use App\Models\Address; use App\Models\Address;
use App\Models\Block; use App\Models\Block;
use App\Models\Claim; use App\Models\Claim;
use App\Models\ClaimStream; use App\Models\ClaimStream;
use App\Models\Input; use App\Models\Input;
use App\Models\Output; use App\Models\Output;
use App\Models\Transaction; use App\Models\Transaction;
use Carbon\Carbon;
use DateTime;
use DateTimeZone;
use Exception;
use Illuminate\Console\Command; use Illuminate\Console\Command;
use Illuminate\Support\Facades\Cache; use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Redis; use Illuminate\Support\Facades\Redis;
use InvalidArgumentException;
use Mdanter\Ecc\EccFactory; use Mdanter\Ecc\EccFactory;
use PDO;
use RedisException;
use Throwable;
class BlockCommand extends Command{ class BlockCommand extends Command{
@ -47,16 +47,13 @@ class BlockCommand extends Command{
*/ */
protected $signature = 'explorer:block {function?}'; protected $signature = 'explorer:block {function?}';
public function __construct(){
parent::__construct();
self::$redis = Redis::connection()->client();
self::$rpcurl = config('lbry.rpc_url');
}
/** /**
* Execute the console command. * Execute the console command.
*/ */
public function handle(): void{ public function handle(): void{
self::$redis = Redis::connection()->client();
self::$rpcurl = config('lbry.rpc_url');
$function = $this->argument('function'); $function = $this->argument('function');
if($function){ if($function){
$this->$function(); $this->$function();
@ -1131,7 +1128,6 @@ class BlockCommand extends Command{
self::lock('parsenewblocks'); self::lock('parsenewblocks');
echo "Parsing new blocks...\n"; echo "Parsing new blocks...\n";
self::$redis = Redis::connection()->client();
try { try {
// Get the best block hash // Get the best block hash
$req = ['method' => 'getbestblockhash', 'params' => [],'id'=>rand()]; $req = ['method' => 'getbestblockhash', 'params' => [],'id'=>rand()];