Fabcoin Core
0.16.2
P2P Digital Currency
|
#include "compiler.h"
#include "endian.h"
#include "ethash.h"
#include <stdio.h>
#include <stdint.h>
Go to the source code of this file.
Classes | |
union | node |
struct | ethash_light |
struct | ethash_full |
Macros | |
#define | ENABLE_SSE 0 |
#define | NODE_WORDS (64/4) |
#define | MIX_WORDS (ETHASH_MIX_BYTES/4) |
#define | MIX_NODES (MIX_WORDS / NODE_WORDS) |
Typedefs | |
typedef union node | node |
Functions | |
bool | ethash_quick_check_difficulty (ethash_h256_t const *header_hash, uint64_t const nonce, ethash_h256_t const *mix_hash, ethash_h256_t const *boundary) |
Difficulty quick check for POW preverification. More... | |
ethash_light_t | ethash_light_new_internal (uint64_t cache_size, ethash_h256_t const *seed) |
Allocate and initialize a new ethash_light handler. More... | |
ethash_return_value_t | ethash_light_compute_internal (ethash_light_t light, uint64_t full_size, ethash_h256_t const header_hash, uint64_t nonce) |
Calculate the light client data. More... | |
ethash_full_t | ethash_full_new_internal (char const *dirname, ethash_h256_t const seed_hash, uint64_t full_size, ethash_light_t const light, ethash_callback_t callback) |
Allocate and initialize a new ethash_full handler. More... | |
void | ethash_calculate_dag_item (node *const ret, uint32_t node_index, ethash_light_t const cache) |
void | ethash_quick_hash (ethash_h256_t *return_hash, ethash_h256_t const *header_hash, const uint64_t nonce, ethash_h256_t const *mix_hash) |
uint64_t | ethash_get_datasize (uint64_t const block_number) |
uint64_t | ethash_get_cachesize (uint64_t const block_number) |
bool | ethash_compute_full_data (void *mem, uint64_t full_size, ethash_light_t const light, ethash_callback_t callback) |
Compute the memory data for a full node's memory. More... | |
#define ENABLE_SSE 0 |
Definition at line 7 of file internal.h.
#define MIX_NODES (MIX_WORDS / NODE_WORDS) |
Definition at line 22 of file internal.h.
#define MIX_WORDS (ETHASH_MIX_BYTES/4) |
Definition at line 21 of file internal.h.
#define NODE_WORDS (64/4) |
Definition at line 20 of file internal.h.
void ethash_calculate_dag_item | ( | node *const | ret, |
uint32_t | node_index, | ||
ethash_light_t const | cache | ||
) |
Definition at line 125 of file internal.c.
bool ethash_compute_full_data | ( | void * | mem, |
uint64_t | full_size, | ||
ethash_light_t const | light, | ||
ethash_callback_t | callback | ||
) |
Compute the memory data for a full node's memory.
mem | A pointer to an ethash full's memory |
full_size | The size of the full data in bytes |
cache | A cache object to use in the calculation |
callback | The callback function. Check ethash_full_new() for details. |
Definition at line 188 of file internal.c.
ethash_full_t ethash_full_new_internal | ( | char const * | dirname, |
ethash_h256_t const | seed_hash, | ||
uint64_t | full_size, | ||
ethash_light_t const | light, | ||
ethash_callback_t | callback | ||
) |
Allocate and initialize a new ethash_full handler.
Internal version.
dirname | The directory in which to put the DAG file. |
seedhash | The seed hash of the block. Used in the DAG file naming. |
full_size | The size of the full data in bytes. |
cache | A cache object to use that was allocated with ethash_cache_new(). Iff this function succeeds the ethash_full_t will take memory memory ownership of the cache and free it at deletion. If not then the user still has to handle freeing of the cache himself. |
callback | A callback function with signature of ethash_callback_t It accepts an unsigned with which a progress of DAG calculation can be displayed. If all goes well the callback should return 0. If a non-zero value is returned then DAG generation will stop. |
Definition at line 466 of file internal.c.
uint64_t ethash_get_cachesize | ( | uint64_t const | block_number | ) |
Definition at line 82 of file internal.c.
uint64_t ethash_get_datasize | ( | uint64_t const | block_number | ) |
Definition at line 76 of file internal.c.
ethash_return_value_t ethash_light_compute_internal | ( | ethash_light_t | light, |
uint64_t | full_size, | ||
ethash_h256_t const | header_hash, | ||
uint64_t | nonce | ||
) |
Calculate the light client data.
Internal version.
light | The light client handler |
full_size | The size of the full data in bytes. |
header_hash | The header hash to pack into the mix |
nonce | The nonce to pack into the mix |
Definition at line 417 of file internal.c.
ethash_light_t ethash_light_new_internal | ( | uint64_t | cache_size, |
ethash_h256_t const * | seed | ||
) |
Allocate and initialize a new ethash_light handler.
Internal version
cache_size | The size of the cache in bytes |
seed | Block seedhash to be used during the computation of the cache nodes |
Definition at line 367 of file internal.c.
bool ethash_quick_check_difficulty | ( | ethash_h256_t const * | header_hash, |
uint64_t const | nonce, | ||
ethash_h256_t const * | mix_hash, | ||
ethash_h256_t const * | boundary | ||
) |
Difficulty quick check for POW preverification.
header_hash | The hash of the header |
nonce | The block's nonce |
mix_hash | The mix digest hash |
boundary | The boundary is defined as (2^256 / difficulty) |
Definition at line 354 of file internal.c.
void ethash_quick_hash | ( | ethash_h256_t * | return_hash, |
ethash_h256_t const * | header_hash, | ||
const uint64_t | nonce, | ||
ethash_h256_t const * | mix_hash | ||
) |
Definition at line 328 of file internal.c.