diff --git a/include/block.inc.php b/include/block.inc.php index 5a3218e..e6af57c 100755 --- a/include/block.inc.php +++ b/include/block.inc.php @@ -290,7 +290,6 @@ class Block $db->commit(); } // relese the locking as everything is finished - $db->exec("UNLOCK TABLES"); /*** * @@ -306,7 +305,7 @@ class Block if($res !== FALSE) { $hostname = 'https://www.ariochain.info'; // hardcoded - _log("Supply",3); + _log("Calculate supply",3); $apiUrl = $hostname.'/api.php?q=node-info'; $aroUrl=file_get_contents($apiUrl); @@ -325,7 +324,8 @@ class Block if ($last>216000) { $votes=[]; - $r=$this->db('SELECT id, val FROM votes'); + $r=$db->run("SELECT id,val FROM votes"); + foreach ($r as $vote) { $votes[$vote['id']]=$vote['val']; } @@ -380,6 +380,8 @@ class Block ); } + $db->exec("UNLOCK TABLES"); + return true; } diff --git a/sanity.php b/sanity.php index 5567ca8..832d23c 100755 --- a/sanity.php +++ b/sanity.php @@ -96,16 +96,11 @@ $current = $block->current(); if ($current['height']==1) { echo "Bootstrapping!\n"; $db_name=substr($_config['db_connect'], strrpos($_config['db_connect'], "dbname=")+7); -<<<<<<< HEAD $db_host=substr($_config['db_connect'], strpos($_config['db_connect'], ":host=")+6); $db_host=substr($db_host, 0, strpos($db_host, ";")); echo "DB name: $db_name\n"; echo "DB host: $db_host\n"; -======= - $db_host=substr($_config['db_connect'], strrpos($_config['db_connect'], "host=")+5, strrpos($_config['db_connect'], ";") - strlen($_config['db_connect'])); - echo "DB name: $db_name, DB host: $db_host\n"; ->>>>>>> 8303376372d15ce8f69978d7e7ea495571c4affa echo "Downloading the blockchain dump from arionum.info\n"; $arofile=__DIR__ . '/tmp/aro.sql'; if (file_exists("/usr/bin/curl")) { @@ -119,7 +114,6 @@ if ($current['height']==1) { echo "Importing the blockchain dump\n"; system("mysql -h ".escapeshellarg($db_host)." -u ".escapeshellarg($_config['db_user'])." -p".escapeshellarg($_config['db_pass'])." ".escapeshellarg($db_name). " < ".$arofile); -<<<<<<< HEAD echo "Bootstrapping completed. Waiting 2mins for the tables to be unlocked.\n"; while (1) { @@ -134,10 +128,6 @@ if ($current['height']==1) { -======= - echo "Bootstrapping completed. Sleeping for 3 min. \n"; - sleep(180); ->>>>>>> 8303376372d15ce8f69978d7e7ea495571c4affa $current = $block->current(); } // the microsanity process is an anti-fork measure that will determine the best blockchain to choose for the last block