Skip to content
Snippets Groups Projects
Commit a3362a14 authored by Dmitriy Gerasimov's avatar Dmitriy Gerasimov
Browse files

[+] Simple block mining function

[+] Declarations for chain operations
[+] Block cache
[+] Block dump
[*] Some internal fixes
parent 798d7d72
No related branches found
No related tags found
1 merge request!24Support 3689
...@@ -24,14 +24,39 @@ ...@@ -24,14 +24,39 @@
#pragma once #pragma once
#include "dap_enc_key.h"
#include "dap_chain_common.h" #include "dap_chain_common.h"
#include "dap_chain_wallet.h" #include "dap_chain_wallet.h"
#define DAP_CHAIN_WALLET_FILE_SIGNATURE 0x1a167bef15feea18
typedef struct dap_chain_wallet_key{
struct {
dap_chain_sig_type_t sig_type; /// Signature type
uint32_t key_size; /// Private key size
} header;
uint8_t key_raw[]; /// Raw data of the private key
} DAP_ALIGN_PACKED dap_chain_wallet_key_t;
typedef struct dap_chain_wallet_file
{
struct {
uint64_t signature;
uint32_t version;
uint8_t type; /// Wallet storage type 0x00 - uncompressed and unencrypted
uint64_t keys_size;
} DAP_ALIGN_PACKED header;
uint8_t keys[];
} DAP_ALIGN_PACKED dap_chain_wallet_file_t;
typedef struct dap_chain_wallet_internal typedef struct dap_chain_wallet_internal
{ {
dap_chain_addr_t addr; dap_chain_addr_t addr;
char * file_name; char * file_name;
size_t keys_count;
dap_enc_key_t ** keys;
} dap_chain_wallet_internal_t; } dap_chain_wallet_internal_t;
#define DAP_CHAIN_WALLET_INTERNAL(a) ((dap_chain_wallet_internal_t *) a->_internal ) #define DAP_CHAIN_WALLET_INTERNAL(a) ((dap_chain_wallet_internal_t *) a->_internal )
......
...@@ -34,7 +34,7 @@ typedef enum dap_hash_type { ...@@ -34,7 +34,7 @@ typedef enum dap_hash_type {
DAP_HASH_TYPE_SLOW_0 = 1, DAP_HASH_TYPE_SLOW_0 = 1,
} dap_hash_type_t; } dap_hash_type_t;
inline void dap_hash(void * a_data_in, size_t a_data_in_size, inline static void dap_hash(void * a_data_in, size_t a_data_in_size,
void * a_data_out, size_t a_data_out_size, void * a_data_out, size_t a_data_out_size,
dap_hash_type_t a_type ){ dap_hash_type_t a_type ){
switch (a_type){ switch (a_type){
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
#include "keccak.h" #include "keccak.h"
inline void dap_hash_keccak(const void * a_in, size_t a_in_size, void * a_out, size_t a_out_size) static inline void dap_hash_keccak(const void * a_in, size_t a_in_size, void * a_out, size_t a_out_size)
{ {
keccak((const uint8_t*) a_in,a_in_size, (uint8_t *) a_out, a_out_size ); keccak((const uint8_t*) a_in,a_in_size, (uint8_t *) a_out, a_out_size );
} }
......
...@@ -34,10 +34,10 @@ ...@@ -34,10 +34,10 @@
* @param a_in_length * @param a_in_length
* @param a_out Must be allocated with enought space * @param a_out Must be allocated with enought space
*/ */
inline void dap_hash_slow(const void *a_in, size_t a_in_length, char * a_out) static inline void dap_hash_slow(const void *a_in, size_t a_in_length, char * a_out)
{ {
cn_slow_hash(a_in,a_in_length,a_out); cn_slow_hash(a_in,a_in_length,a_out);
} }
inline size_t dap_hash_slow_size() { return DAP_HASH_SLOW_SIZE; } static inline size_t dap_hash_slow_size() { return DAP_HASH_SLOW_SIZE; }
//cn_slow_hash(data, length, reinterpret_cast<char *>(&hash)); //cn_slow_hash(data, length, reinterpret_cast<char *>(&hash));
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment