LCOV - code coverage report
Current view: top level - src/consensus - consensus.h (source / functions) Hit Total Coverage
Test: bitcoincash_test.info Lines: 1 1 100.0 %
Date: 2018-04-13 15:12:50 Functions: 0 0 -

          Line data    Source code
       1             : // Copyright (c) 2009-2010 Satoshi Nakamoto
       2             : // Copyright (c) 2009-2016 The Bitcoin Core developers
       3             : // Distributed under the MIT software license, see the accompanying
       4             : // file COPYING or http://www.opensource.org/licenses/mit-license.php.
       5             : 
       6             : #ifndef BITCOIN_CONSENSUS_CONSENSUS_H
       7             : #define BITCOIN_CONSENSUS_CONSENSUS_H
       8             : 
       9             : #include <cstdint>
      10             : 
      11             : /** 1MB */
      12             : static const uint64_t ONE_MEGABYTE = 1000000;
      13             : /** The maximum allowed size for a transaction, in bytes */
      14             : static const uint64_t MAX_TX_SIZE = ONE_MEGABYTE;
      15             : /** The maximum allowed size for a block, before the UAHF */
      16             : static const uint64_t LEGACY_MAX_BLOCK_SIZE = ONE_MEGABYTE;
      17             : /** Default setting for maximum allowed size for a block, in bytes */
      18             : static const uint64_t DEFAULT_MAX_BLOCK_SIZE = 32 * ONE_MEGABYTE;
      19             : /** The maximum allowed number of signature check operations per MB in a block
      20             :  * (network rule) */
      21             : static const int64_t MAX_BLOCK_SIGOPS_PER_MB = 20000;
      22             : /** allowed number of signature check operations per transaction. */
      23             : static const uint64_t MAX_TX_SIGOPS_COUNT = 20000;
      24             : /** Coinbase transaction outputs can only be spent after this number of new
      25             :  * blocks (network rule) */
      26             : static const int COINBASE_MATURITY = 100;
      27             : 
      28             : /** Flags for nSequence and nLockTime locks */
      29             : enum {
      30             :     /* Interpret sequence numbers as relative lock-time constraints. */
      31             :     LOCKTIME_VERIFY_SEQUENCE = (1 << 0),
      32             : 
      33             :     /* Use GetMedianTimePast() instead of nTime for end point timestamp. */
      34             :     LOCKTIME_MEDIAN_TIME_PAST = (1 << 1),
      35             : };
      36             : 
      37             : /**
      38             :  * Compute the maximum number of sigops operation that can contained in a block
      39             :  * given the block size as parameter. It is computed by multiplying
      40             :  * MAX_BLOCK_SIGOPS_PER_MB by the size of the block in MB rounded up to the
      41             :  * closest integer.
      42             :  */
      43             : inline uint64_t GetMaxBlockSigOpsCount(uint64_t blockSize) {
      44           9 :     auto nMbRoundedUp = 1 + ((blockSize - 1) / ONE_MEGABYTE);
      45             :     return nMbRoundedUp * MAX_BLOCK_SIGOPS_PER_MB;
      46             : }
      47             : 
      48             : #endif // BITCOIN_CONSENSUS_CONSENSUS_H

Generated by: LCOV version 1.12