Browse Source

Consensus: Create consensus/consensus.h with some constants

0.13
jtimon 10 years ago committed by Jorge Timón
parent
commit
691161d419
  1. 1
      src/Makefile.am
  2. 8
      src/bitcoin-tx.cpp
  3. 18
      src/consensus/consensus.h
  4. 9
      src/main.h
  5. 2
      src/merkleblock.cpp
  6. 1
      src/miner.cpp
  7. 3
      src/primitives/block.h
  8. 2
      src/qt/transactiondesc.cpp
  9. 1
      src/qt/transactionrecord.cpp
  10. 3
      src/rpcmining.cpp
  11. 1
      src/txmempool.cpp
  12. 1
      src/wallet/wallet.cpp

1
src/Makefile.am

@ -87,6 +87,7 @@ BITCOIN_CORE_H = \ @@ -87,6 +87,7 @@ BITCOIN_CORE_H = \
coins.h \
compat.h \
compressor.h \
consensus/consensus.h \
consensus/params.h \
core_io.h \
wallet/db.h \

8
src/bitcoin-tx.cpp

@ -4,18 +4,18 @@ @@ -4,18 +4,18 @@
#include "base58.h"
#include "clientversion.h"
#include "primitives/block.h" // for MAX_BLOCK_SIZE
#include "primitives/transaction.h"
#include "core_io.h"
#include "coins.h"
#include "consensus/consensus.h"
#include "core_io.h"
#include "keystore.h"
#include "primitives/transaction.h"
#include "script/script.h"
#include "script/sign.h"
#include "ui_interface.h" // for _(...)
#include "univalue/univalue.h"
#include "util.h"
#include "utilstrencodings.h"
#include "utilmoneystr.h"
#include "utilstrencodings.h"
#include <stdio.h>

18
src/consensus/consensus.h

@ -0,0 +1,18 @@ @@ -0,0 +1,18 @@
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2014 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_CONSENSUS_CONSENSUS_H
#define BITCOIN_CONSENSUS_CONSENSUS_H
/** The maximum allowed size for a serialized block, in bytes (network rule) */
static const unsigned int MAX_BLOCK_SIZE = 1000000;
/** The maximum allowed number of signature check operations in a block (network rule) */
static const unsigned int MAX_BLOCK_SIGOPS = MAX_BLOCK_SIZE/50;
/** Coinbase transaction outputs can only be spent after this number of new blocks (network rule) */
static const int COINBASE_MATURITY = 100;
/** Threshold for nLockTime: below this value it is interpreted as block number, otherwise as UNIX timestamp. */
static const unsigned int LOCKTIME_THRESHOLD = 500000000; // Tue Nov 5 00:53:20 1985 UTC
#endif // BITCOIN_CONSENSUS_CONSENSUS_H

9
src/main.h

@ -14,9 +14,10 @@ @@ -14,9 +14,10 @@
#include "chain.h"
#include "chainparams.h"
#include "coins.h"
#include "consensus/consensus.h"
#include "net.h"
#include "primitives/block.h"
#include "primitives/transaction.h"
#include "net.h"
#include "script/script.h"
#include "script/sigcache.h"
#include "script/standard.h"
@ -53,8 +54,6 @@ static const unsigned int DEFAULT_BLOCK_MIN_SIZE = 0; @@ -53,8 +54,6 @@ static const unsigned int DEFAULT_BLOCK_MIN_SIZE = 0;
static const unsigned int DEFAULT_BLOCK_PRIORITY_SIZE = 50000;
/** The maximum size for transactions we're willing to relay/mine */
static const unsigned int MAX_STANDARD_TX_SIZE = 100000;
/** The maximum allowed number of signature check operations in a block (network rule) */
static const unsigned int MAX_BLOCK_SIGOPS = MAX_BLOCK_SIZE/50;
/** Maximum number of signature check operations in an IsStandard() P2SH script */
static const unsigned int MAX_P2SH_SIGOPS = 15;
/** The maximum number of sigops we're willing to relay/mine in a single tx */
@ -67,10 +66,6 @@ static const unsigned int MAX_BLOCKFILE_SIZE = 0x8000000; // 128 MiB @@ -67,10 +66,6 @@ static const unsigned int MAX_BLOCKFILE_SIZE = 0x8000000; // 128 MiB
static const unsigned int BLOCKFILE_CHUNK_SIZE = 0x1000000; // 16 MiB
/** The pre-allocation chunk size for rev?????.dat files (since 0.8) */
static const unsigned int UNDOFILE_CHUNK_SIZE = 0x100000; // 1 MiB
/** Coinbase transaction outputs can only be spent after this number of new blocks (network rule) */
static const int COINBASE_MATURITY = 100;
/** Threshold for nLockTime: below this value it is interpreted as block number, otherwise as UNIX timestamp. */
static const unsigned int LOCKTIME_THRESHOLD = 500000000; // Tue Nov 5 00:53:20 1985 UTC
/** Maximum number of script-checking threads allowed */
static const int MAX_SCRIPTCHECK_THREADS = 16;
/** -par default (number of script-checking threads, 0 = auto) */

2
src/merkleblock.cpp

@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
#include "merkleblock.h"
#include "hash.h"
#include "primitives/block.h" // for MAX_BLOCK_SIZE
#include "consensus/consensus.h"
#include "utilstrencodings.h"
using namespace std;

1
src/miner.cpp

@ -7,6 +7,7 @@ @@ -7,6 +7,7 @@
#include "amount.h"
#include "chainparams.h"
#include "consensus/consensus.h"
#include "hash.h"
#include "main.h"
#include "net.h"

3
src/primitives/block.h

@ -10,9 +10,6 @@ @@ -10,9 +10,6 @@
#include "serialize.h"
#include "uint256.h"
/** The maximum allowed size for a serialized block, in bytes (network rule) */
static const unsigned int MAX_BLOCK_SIZE = 1000000;
/** Nodes collect new transactions into a block, hash them into a hash tree,
* and scan through nonce values to make the block's hash satisfy proof-of-work
* requirements. When they solve the proof-of-work, they broadcast the block

2
src/qt/transactiondesc.cpp

@ -10,11 +10,13 @@ @@ -10,11 +10,13 @@
#include "transactionrecord.h"
#include "base58.h"
#include "consensus/consensus.h"
#include "main.h"
#include "script/script.h"
#include "timedata.h"
#include "ui_interface.h"
#include "util.h"
#include "wallet/db.h"
#include "wallet/wallet.h"
#include <stdint.h>

1
src/qt/transactionrecord.cpp

@ -5,6 +5,7 @@ @@ -5,6 +5,7 @@
#include "transactionrecord.h"
#include "base58.h"
#include "consensus/consensus.h"
#include "main.h"
#include "timedata.h"
#include "wallet/wallet.h"

3
src/rpcmining.cpp

@ -5,11 +5,12 @@ @@ -5,11 +5,12 @@
#include "amount.h"
#include "chainparams.h"
#include "consensus/consensus.h"
#include "core_io.h"
#include "init.h"
#include "net.h"
#include "main.h"
#include "miner.h"
#include "net.h"
#include "pow.h"
#include "rpcserver.h"
#include "util.h"

1
src/txmempool.cpp

@ -6,6 +6,7 @@ @@ -6,6 +6,7 @@
#include "txmempool.h"
#include "clientversion.h"
#include "consensus/consensus.h"
#include "main.h"
#include "streams.h"
#include "util.h"

1
src/wallet/wallet.cpp

@ -8,6 +8,7 @@ @@ -8,6 +8,7 @@
#include "base58.h"
#include "checkpoints.h"
#include "coincontrol.h"
#include "consensus/consensus.h"
#include "main.h"
#include "net.h"
#include "script/script.h"

Loading…
Cancel
Save