From 1694c558df3cf7f34e42f3db62c83931117c9b00 Mon Sep 17 00:00:00 2001 From: Lefteris Karapetsas Date: Wed, 8 Apr 2015 11:56:04 +0200 Subject: [PATCH] Keep part of the old API for smoother transition --- ethash.h | 23 ++++++++++++++++++++++- internal.c | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 1 deletion(-) diff --git a/ethash.h b/ethash.h index a6bbe97a1..121ba12a2 100644 --- a/ethash.h +++ b/ethash.h @@ -45,7 +45,7 @@ extern "C" { // LTODO: for consistency's sake maybe use ethash_params_t? typedef struct ethash_params { /// Size of full data set (in bytes, multiple of mix size (128)). - int64_t full_size; + uint64_t full_size; /// Size of compute cache (in bytes, multiple of node size (64)). uint64_t cache_size; } ethash_params; @@ -208,6 +208,27 @@ int ethash_quick_check_difficulty(ethash_h256_t const *header_hash, ethash_h256_t const *mix_hash, ethash_h256_t const *difficulty); + +/** + * ========================= + * = DEPRECATED API = + * ========================= + * + * Kept for backwards compatibility with whoever still uses it. Please consider + * switching to the new API (look above) + */ +void ethash_mkcache(ethash_cache *cache, ethash_params const *params, ethash_h256_t const *seed); +void ethash_full(ethash_return_value *ret, + void const *full_mem, + ethash_params const *params, + ethash_h256_t const *header_hash, + const uint64_t nonce); +void ethash_light(ethash_return_value *ret, + ethash_cache const *cache, + ethash_params const *params, + ethash_h256_t const *header_hash, + const uint64_t nonce); + #ifdef __cplusplus } #endif diff --git a/internal.c b/internal.c index 03dc8eb25..181bf4f4b 100644 --- a/internal.c +++ b/internal.c @@ -411,3 +411,36 @@ bool ethash_full_compute(ethash_return_value *ret, nonce, full->callback); } + + +/** + * ========================= + * = DEPRECATED API = + * ========================= + * + * Kept for backwards compatibility with whoever still uses it. Please consider + * switching to the new API (look above) + */ +void ethash_mkcache(ethash_cache *cache, + ethash_params const *params, + ethash_h256_t const* seed) +{ + node *nodes = (node*) cache->mem; + ethash_compute_cache_nodes(nodes, params, seed); +} +void ethash_full(ethash_return_value *ret, + void const *full_mem, + ethash_params const *params, + ethash_h256_t const *header_hash, + const uint64_t nonce) +{ + ethash_hash(ret, (node const *) full_mem, NULL, params, header_hash, nonce, NULL); +} +void ethash_light(ethash_return_value *ret, + ethash_cache const *cache, + ethash_params const *params, + ethash_h256_t const *header_hash, + const uint64_t nonce) +{ + ethash_hash(ret, NULL, cache, params, header_hash, nonce, NULL); +}