From 514daaeaf1d953644db8f970a9e2fb9cee6acf1d Mon Sep 17 00:00:00 2001 From: MEUNIER Thibaud Date: Sun, 7 Apr 2019 10:16:41 +0200 Subject: [PATCH] nonce_binary_str --- bcoin_io/robot.php | 2 ++ blockchain/inc/block.php | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/bcoin_io/robot.php b/bcoin_io/robot.php index 1c6eb84..8584b8a 100644 --- a/bcoin_io/robot.php +++ b/bcoin_io/robot.php @@ -2,6 +2,8 @@ $url = 'http://x:m3lch1s3d3k@127.0.0.1:8332'; +$url = 'http://bitcoinrpc:EF/iNKFWzQkpoTB+VFaSGk1+qZPckHsLfKu+3HZddpRr@77.159.16.114:8332'; + $data = array("method" => "getbestblockhash"); $json_data = json_encode($data); diff --git a/blockchain/inc/block.php b/blockchain/inc/block.php index 1f6e72a..4d4b171 100644 --- a/blockchain/inc/block.php +++ b/blockchain/inc/block.php @@ -259,6 +259,14 @@ class blockchain { if (file_exists(DATA_PATH.'/json/'.$the_block->hash.'.zip')) return $the_block; + // Blockchain.info renvoie des nonces négatifs + // Je repasse par la forme binaire pour retrouver + // une valeur positive + $the_block->nonce_binary_str = decbin($the_block->nonce); + if (strlen($the_block->nonce_binary_str) > 32) $the_block->nonce_binray_str = substr($nonce_binray_str,-32,32); + $the_block->topisto_nonce_blockchain_info = $the_block->nonce; + $the_block->nonce = bindec($the_block->nonce_binray_str); + if (!isset($the_block->topisto_inputs)) { $the_block->topisto_inputs = 0;