Fabcoin Core  0.16.2
P2P Digital Currency
Classes | Macros | Typedefs | Functions
internal.h File Reference
#include "compiler.h"
#include "endian.h"
#include "ethash.h"
#include <stdio.h>
#include <stdint.h>
Include dependency graph for internal.h:
This graph shows which files directly or indirectly include this file:

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...
 

Macro Definition Documentation

#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.

Typedef Documentation

typedef union node node

Function Documentation

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.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters
memA pointer to an ethash full's memory
full_sizeThe size of the full data in bytes
cacheA cache object to use in the calculation
callbackThe callback function. Check ethash_full_new() for details.
Returns
true if all went fine and false for invalid parameters

Definition at line 188 of file internal.c.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters
dirnameThe directory in which to put the DAG file.
seedhashThe seed hash of the block. Used in the DAG file naming.
full_sizeThe size of the full data in bytes.
cacheA 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.
callbackA 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.
Returns
Newly allocated ethash_full handler or NULL in case of ERRNOMEM or invalid parameters used for ethash_compute_full_data()

Definition at line 466 of file internal.c.

Here is the call graph for this function:

Here is the caller graph for this function:

uint64_t ethash_get_cachesize ( uint64_t const  block_number)

Definition at line 82 of file internal.c.

Here is the call graph for this function:

Here is the caller graph for this function:

uint64_t ethash_get_datasize ( uint64_t const  block_number)

Definition at line 76 of file internal.c.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters
lightThe light client handler
full_sizeThe size of the full data in bytes.
header_hashThe header hash to pack into the mix
nonceThe nonce to pack into the mix
Returns
The resulting hash.

Definition at line 417 of file internal.c.

Here is the caller graph for this function:

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

Parameters
cache_sizeThe size of the cache in bytes
seedBlock seedhash to be used during the computation of the cache nodes
Returns
Newly allocated ethash_light handler or NULL in case of ERRNOMEM or invalid parameters used for ethash_compute_cache_nodes()

Definition at line 367 of file internal.c.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters
header_hashThe hash of the header
nonceThe block's nonce
mix_hashThe mix digest hash
boundaryThe boundary is defined as (2^256 / difficulty)
Returns
true for succesful pre-verification and false otherwise

Definition at line 354 of file internal.c.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Here is the call graph for this function:

Here is the caller graph for this function: