Browse Source

Adding Block verification tests

- The data for the block verification come from the POC-9 testnet.

- Also using boolean instead of int in check_difficulty for the verification
cl-refactor
Lefteris Karapetsas 10 years ago
parent
commit
d622fdfd76
  1. 2
      internal.c
  2. 6
      internal.h

2
internal.c

@ -280,7 +280,7 @@ ethash_h256_t ethash_get_seedhash(uint64_t block_number)
return ret; return ret;
} }
int ethash_quick_check_difficulty( bool ethash_quick_check_difficulty(
ethash_h256_t const* header_hash, ethash_h256_t const* header_hash,
uint64_t const nonce, uint64_t const nonce,
ethash_h256_t const* mix_hash, ethash_h256_t const* mix_hash,

6
internal.h

@ -47,7 +47,7 @@ static inline void ethash_h256_reset(ethash_h256_t* hash)
} }
// Returns if hash is less than or equal to difficulty // Returns if hash is less than or equal to difficulty
static inline int ethash_check_difficulty( static inline bool ethash_check_difficulty(
ethash_h256_t const* hash, ethash_h256_t const* hash,
ethash_h256_t const* difficulty ethash_h256_t const* difficulty
) )
@ -59,10 +59,10 @@ static inline int ethash_check_difficulty(
} }
return ethash_h256_get(hash, i) < ethash_h256_get(difficulty, i); return ethash_h256_get(hash, i) < ethash_h256_get(difficulty, i);
} }
return 1; return true;
} }
int ethash_quick_check_difficulty( bool ethash_quick_check_difficulty(
ethash_h256_t const* header_hash, ethash_h256_t const* header_hash,
uint64_t const nonce, uint64_t const nonce,
ethash_h256_t const* mix_hash, ethash_h256_t const* mix_hash,

Loading…
Cancel
Save