diff --git a/dap_chain_block.h b/dap_chain_block.h index 9676d15ba283b06f402674dc01c6f18b2872e6d8..4e3426d89362d4e8cb931e083f718ac0339dba5b 100644 --- a/dap_chain_block.h +++ b/dap_chain_block.h @@ -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