block change

This commit is contained in:
Arionum
2018-02-22 21:31:56 +02:00
parent 1b03a3a292
commit 6f05bd7da0
2 changed files with 5 additions and 5 deletions

View File

@@ -16,8 +16,8 @@ public function add($height, $public_key, $nonce, $data, $date, $signature, $dif
// create the hash / block id
$hash=$this->hash($generator, $height, $date, $nonce, $data, $signature, $difficulty, $argon);
//fix for the broken base58 library used until block 17000, trimming the first 0 bytes.
if($height<=17000) $hash=ltrim($hash,'1');
//fix for the broken base58 library used until block 16900, trimming the first 0 bytes.
if($height<16900) $hash=ltrim($hash,'1');
$json=json_encode($data);

View File

@@ -162,13 +162,13 @@ class Transaction {
// no future transactions
if($x['date']>time()+86400) { _log("$x[id] - Date in the future"); return false; }
// prevent the resending of broken base58 transactions
if($height>16890&&$x['date']<1519323683) return false;
if($height>16000&&$x['date']<1519326876) return false;
$id=$this->hash($x);
// the hash does not match our regenerated hash
if($x['id']!=$id) {
// fix for broken base58 library which was used until block 17000, accepts hashes without the first 1 or 2 bytes
// fix for broken base58 library which was used until block 16900, accepts hashes without the first 1 or 2 bytes
$xs=base58_decode($x['id']);
if(((strlen($xs)!=63||substr($id,1)!=$x['id'])&&(strlen($xs)!=62||substr($id,2)!=$x['id']))||$height>17000){
if(((strlen($xs)!=63||substr($id,1)!=$x['id'])&&(strlen($xs)!=62||substr($id,2)!=$x['id']))||$height>16900){
_log("$x[id] - $id - Invalid hash");
return false;
}