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

[+] Sharded variant of block's header

parent 62b75944
No related branches found
No related tags found
No related merge requests found
......@@ -43,15 +43,29 @@ typedef struct dap_chain_block{
uint32_t signature; /// @param signature @brief Magic number, always equels to DAP_CHAIN_BLOCK_SIGNATURE
int32_t version; /// @param version @brief block version (be carefull, signed value, as Bitcoin has)
uint32_t size; /// @param size of the whole block
dap_chain_hash_t prev_block; /// @param prev_block Hash of the previous block
uint64_t timestamp; /// @param timestamp @brief Block create time timestamp
uint64_t difficulty; /// difficulty level
uint64_t nonce; /// Nonce value to allow header variation for mining
uint64_t difficulty; /// difficulty level
uint64_t nonce; /// Nonce value to allow header variation for mining
union{
struct{ // Zero-level block without sharding
dap_chain_hash_t prev_block; /// @param prev_block Hash of the previous block
dap_chain_hash_t padding0; //
uint32_t padding1; //
uint64_t padding2; // Always zero (should be well compresed)
};
struct{
dap_chain_hash_t prev_block_0lvl; /// @param prev_block Hash of the previous block
dap_chain_hash_t prev_block_shard; /// @param prev_block Hash of the previous block
uint32_t shard_id; // Shard id
uint64_t nonce2; // Second NonCE for block mining inside the shard
}
}
dap_chain_hash_t root_sections;/// @param root_main Main tree's root for all sections's hashes
} DAP_ALIGN_PACKED header;
uint8_t sections[]; // Sections
} DAP_ALIGN_PACKED dap_chain_block_t;
dap_chain_block_t * dap_chain_block_new(dap_chain_hash_t * a_prev_block );
dap_chain_section_t * dap_chain_block_create_section(dap_chain_block_t * a_block, uint32_t a_section_offset
......
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