aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjtimon <jtimon@jtimon.cc>2015-01-24 15:29:29 +0100
committerJorge Timón <jtimon@jtimon.cc>2015-04-20 21:27:51 +0200
commit691161d419fe3d82d7a49b511ef80e2b24332aac (patch)
treefb657b9aba2aa42ff9948fcfc428845b60384c35
parentb6ea3bcede1cbbf89486b9d67329e0110c4624ae (diff)
Consensus: Create consensus/consensus.h with some constants
-rw-r--r--src/Makefile.am1
-rw-r--r--src/bitcoin-tx.cpp8
-rw-r--r--src/consensus/consensus.h18
-rw-r--r--src/main.h9
-rw-r--r--src/merkleblock.cpp2
-rw-r--r--src/miner.cpp1
-rw-r--r--src/primitives/block.h3
-rw-r--r--src/qt/transactiondesc.cpp2
-rw-r--r--src/qt/transactionrecord.cpp1
-rw-r--r--src/rpcmining.cpp3
-rw-r--r--src/txmempool.cpp1
-rw-r--r--src/wallet/wallet.cpp1
12 files changed, 34 insertions, 16 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 37184b6286..72d79619b2 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -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 \
diff --git a/src/bitcoin-tx.cpp b/src/bitcoin-tx.cpp
index 78f5c2c4b6..f1c1c0ff8b 100644
--- a/src/bitcoin-tx.cpp
+++ b/src/bitcoin-tx.cpp
@@ -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>
diff --git a/src/consensus/consensus.h b/src/consensus/consensus.h
new file mode 100644
index 0000000000..9c5b7d4ffb
--- /dev/null
+++ b/src/consensus/consensus.h
@@ -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
diff --git a/src/main.h b/src/main.h
index bb6fd6f204..a4c34c5345 100644
--- a/src/main.h
+++ b/src/main.h
@@ -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;
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
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) */
diff --git a/src/merkleblock.cpp b/src/merkleblock.cpp
index b51b002b95..c48d8cd508 100644
--- a/src/merkleblock.cpp
+++ b/src/merkleblock.cpp
@@ -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;
diff --git a/src/miner.cpp b/src/miner.cpp
index 3abd2d68e4..56a2c5828b 100644
--- a/src/miner.cpp
+++ b/src/miner.cpp
@@ -7,6 +7,7 @@
#include "amount.h"
#include "chainparams.h"
+#include "consensus/consensus.h"
#include "hash.h"
#include "main.h"
#include "net.h"
diff --git a/src/primitives/block.h b/src/primitives/block.h
index c7ed6f723a..59f46deb1c 100644
--- a/src/primitives/block.h
+++ b/src/primitives/block.h
@@ -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
diff --git a/src/qt/transactiondesc.cpp b/src/qt/transactiondesc.cpp
index 4a2c51477e..7214249435 100644
--- a/src/qt/transactiondesc.cpp
+++ b/src/qt/transactiondesc.cpp
@@ -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>
diff --git a/src/qt/transactionrecord.cpp b/src/qt/transactionrecord.cpp
index 9db5ad0fd4..7f1db58e5d 100644
--- a/src/qt/transactionrecord.cpp
+++ b/src/qt/transactionrecord.cpp
@@ -5,6 +5,7 @@
#include "transactionrecord.h"
#include "base58.h"
+#include "consensus/consensus.h"
#include "main.h"
#include "timedata.h"
#include "wallet/wallet.h"
diff --git a/src/rpcmining.cpp b/src/rpcmining.cpp
index 851d113f3b..8398a33f75 100644
--- a/src/rpcmining.cpp
+++ b/src/rpcmining.cpp
@@ -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"
diff --git a/src/txmempool.cpp b/src/txmempool.cpp
index 85ea3f77b5..d05e3c6eec 100644
--- a/src/txmempool.cpp
+++ b/src/txmempool.cpp
@@ -6,6 +6,7 @@
#include "txmempool.h"
#include "clientversion.h"
+#include "consensus/consensus.h"
#include "main.h"
#include "streams.h"
#include "util.h"
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp
index 0d40469393..88e6610dec 100644
--- a/src/wallet/wallet.cpp
+++ b/src/wallet/wallet.cpp
@@ -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"