LCOV - code coverage report
Current view: top level - irohad/model - block.hpp (source / functions) Hit Total Coverage
Test: cleared_cor.info Lines: 5 5 100.0 %
Date: 2019-03-07 14:46:43 Functions: 8 8 100.0 %

          Line data    Source code
       1             : /**
       2             :  * Copyright Soramitsu Co., Ltd. All Rights Reserved.
       3             :  * SPDX-License-Identifier: Apache-2.0
       4             :  */
       5             : 
       6             : #ifndef IROHA_BLOCK_HPP
       7             : #define IROHA_BLOCK_HPP
       8             : 
       9             : #include <vector>
      10             : 
      11             : #include "crypto/hash_types.hpp"
      12             : #include "model/proposal.hpp"
      13             : #include "model/signature.hpp"
      14             : #include "model/transaction.hpp"
      15             : 
      16             : namespace iroha {
      17             :   namespace model {
      18             : 
      19             :     /**
      20             :      * Block is Model-structure, that provides all block-related information
      21             :      * Block can be divided into payload which contains all the data
      22             :      * and signatures of this data.
      23             :      */
      24             :     struct Block {
      25             :       /**
      26             :        * Calculated as hash(PAYLOAD field)
      27             :        * NOT a part of payload
      28             :        */
      29           5 :       hash256_t hash{};
      30             : 
      31             :       using HashType = decltype(hash);
      32             : 
      33             :       /**
      34             :        * List of signatures for signing the block
      35             :        * NOT a part of PAYLOAD
      36             :        */
      37             :       std::vector<Signature> sigs;
      38             : 
      39             :       using SignaturesType = decltype(sigs);
      40             : 
      41             :       /**
      42             :        * Timestamp of block creation(signing)
      43             :        * part of PAYLOAD
      44             :        */
      45           5 :       ts64_t created_ts{};
      46             : 
      47             :       /**
      48             :        * Block number in the ledger
      49             :        * Height can be used as block_id
      50             :        * part of PAYLOAD
      51             :        */
      52           5 :       uint64_t height{};
      53             : 
      54             :       using BlockHeightType = decltype(height);
      55             : 
      56             :       /**
      57             :        * Hash of a previous block in the ledger
      58             :        * part of PAYLOAD
      59             :        */
      60           5 :       hash256_t prev_hash{};
      61             : 
      62             :       /**
      63             :        * Number of transactions in block body
      64             :        * part of PAYLOAD
      65             :        */
      66           5 :       uint16_t txs_number{};
      67             : 
      68             :       /**
      69             :        * Attached transactions
      70             :        * part of PAYLOAD
      71             :        */
      72             :       std::vector<Transaction> transactions;
      73             : 
      74             :       using TransactionsType = decltype(transactions);
      75             : 
      76             :       /**
      77             :        * Attached rejected transactions' hashes
      78             :        * part of PAYLOAD
      79             :        */
      80             :       std::vector<HashType> rejected_transactions_hashes;
      81             : 
      82             :       using RejectedTransactionsType = decltype(rejected_transactions_hashes);
      83             : 
      84             :       bool operator==(const Block &rhs) const;
      85             :       bool operator!=(const Block &rhs) const;
      86             :     };
      87             :   }  // namespace model
      88             : }  // namespace iroha
      89             : 
      90             : #endif  // IROHA_BLOCK_HPP

Generated by: LCOV version 1.13