Skip to content

Commit 627b9de

Browse files
committed
Policy: MOVEONLY: Create policy/policy.h with some constants
1 parent 24f2489 commit 627b9de

File tree

12 files changed

+52
-30
lines changed

12 files changed

+52
-30
lines changed

src/Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ BITCOIN_CORE_H = \
111111
netbase.h \
112112
noui.h \
113113
policy/fees.h \
114+
policy/policy.h \
114115
pow.h \
115116
primitives/block.h \
116117
primitives/transaction.h \

src/bitcoin-tx.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include "consensus/consensus.h"
99
#include "core_io.h"
1010
#include "keystore.h"
11+
#include "policy/policy.h"
1112
#include "primitives/transaction.h"
1213
#include "script/script.h"
1314
#include "script/sign.h"

src/init.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "main.h"
1919
#include "miner.h"
2020
#include "net.h"
21+
#include "policy/policy.h"
2122
#include "rpcserver.h"
2223
#include "script/standard.h"
2324
#include "scheduler.h"

src/main.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@
1111
#include "chainparams.h"
1212
#include "checkpoints.h"
1313
#include "checkqueue.h"
14+
#include "consensus/consensus.h"
1415
#include "consensus/validation.h"
1516
#include "init.h"
1617
#include "merkleblock.h"
1718
#include "net.h"
19+
#include "policy/policy.h"
1820
#include "pow.h"
1921
#include "txdb.h"
2022
#include "txmempool.h"

src/main.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#include "chain.h"
1515
#include "chainparams.h"
1616
#include "coins.h"
17-
#include "consensus/consensus.h"
1817
#include "net.h"
1918
#include "primitives/block.h"
2019
#include "primitives/transaction.h"
@@ -47,19 +46,8 @@ class CValidationState;
4746

4847
struct CNodeStateStats;
4948

50-
/** Default for -blockmaxsize and -blockminsize, which control the range of sizes the mining code will create **/
51-
static const unsigned int DEFAULT_BLOCK_MAX_SIZE = 750000;
52-
static const unsigned int DEFAULT_BLOCK_MIN_SIZE = 0;
53-
/** Default for -blockprioritysize, maximum space for zero/low-fee transactions **/
54-
static const unsigned int DEFAULT_BLOCK_PRIORITY_SIZE = 50000;
5549
/** Default for accepting alerts from the P2P network. */
5650
static const bool DEFAULT_ALERTS = true;
57-
/** The maximum size for transactions we're willing to relay/mine */
58-
static const unsigned int MAX_STANDARD_TX_SIZE = 100000;
59-
/** Maximum number of signature check operations in an IsStandard() P2SH script */
60-
static const unsigned int MAX_P2SH_SIGOPS = 15;
61-
/** The maximum number of sigops we're willing to relay/mine in a single tx */
62-
static const unsigned int MAX_STANDARD_TX_SIGOPS = MAX_BLOCK_SIGOPS/5;
6351
/** Default for -maxorphantx, maximum number of orphan transactions kept in memory */
6452
static const unsigned int DEFAULT_MAX_ORPHAN_TRANSACTIONS = 100;
6553
/** The maximum size of a blk?????.dat file (since 0.8) */

src/miner.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "hash.h"
1313
#include "main.h"
1414
#include "net.h"
15+
#include "policy/policy.h"
1516
#include "pow.h"
1617
#include "primitives/transaction.h"
1718
#include "timedata.h"

src/policy/policy.h

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// Copyright (c) 2009-2010 Satoshi Nakamoto
2+
// Copyright (c) 2009-2014 The Bitcoin 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_POLICY_H
7+
#define BITCOIN_POLICY_H
8+
9+
#include "consensus/consensus.h"
10+
#include "script/interpreter.h"
11+
#include "script/standard.h"
12+
13+
/** Default for -blockmaxsize and -blockminsize, which control the range of sizes the mining code will create **/
14+
static const unsigned int DEFAULT_BLOCK_MAX_SIZE = 750000;
15+
static const unsigned int DEFAULT_BLOCK_MIN_SIZE = 0;
16+
/** Default for -blockprioritysize, maximum space for zero/low-fee transactions **/
17+
static const unsigned int DEFAULT_BLOCK_PRIORITY_SIZE = 50000;
18+
/** The maximum size for transactions we're willing to relay/mine */
19+
static const unsigned int MAX_STANDARD_TX_SIZE = 100000;
20+
/** Maximum number of signature check operations in an IsStandard() P2SH script */
21+
static const unsigned int MAX_P2SH_SIGOPS = 15;
22+
/** The maximum number of sigops we're willing to relay/mine in a single tx */
23+
static const unsigned int MAX_STANDARD_TX_SIGOPS = MAX_BLOCK_SIGOPS/5;
24+
/**
25+
* Standard script verification flags that standard transactions will comply
26+
* with. However scripts violating these flags may still be present in valid
27+
* blocks and we must accept those blocks.
28+
*/
29+
static const unsigned int STANDARD_SCRIPT_VERIFY_FLAGS = MANDATORY_SCRIPT_VERIFY_FLAGS |
30+
SCRIPT_VERIFY_DERSIG |
31+
SCRIPT_VERIFY_STRICTENC |
32+
SCRIPT_VERIFY_MINIMALDATA |
33+
SCRIPT_VERIFY_NULLDUMMY |
34+
SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS |
35+
SCRIPT_VERIFY_CLEANSTACK |
36+
SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY;
37+
38+
/** For convenience, standard but not mandatory verify flags. */
39+
static const unsigned int STANDARD_NOT_MANDATORY_VERIFY_FLAGS = STANDARD_SCRIPT_VERIFY_FLAGS & ~MANDATORY_SCRIPT_VERIFY_FLAGS;
40+
41+
#endif // BITCOIN_POLICY_H

src/rpcrawtransaction.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "main.h"
1212
#include "merkleblock.h"
1313
#include "net.h"
14+
#include "policy/policy.h"
1415
#include "primitives/transaction.h"
1516
#include "rpcserver.h"
1617
#include "script/script.h"

src/script/sign.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55

66
#include "script/sign.h"
77

8-
#include "primitives/transaction.h"
98
#include "key.h"
109
#include "keystore.h"
10+
#include "policy/policy.h"
11+
#include "primitives/transaction.h"
1112
#include "script/standard.h"
1213
#include "uint256.h"
1314

src/script/standard.h

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -39,23 +39,6 @@ extern unsigned nMaxDatacarrierBytes;
3939
*/
4040
static const unsigned int MANDATORY_SCRIPT_VERIFY_FLAGS = SCRIPT_VERIFY_P2SH;
4141

42-
/**
43-
* Standard script verification flags that standard transactions will comply
44-
* with. However scripts violating these flags may still be present in valid
45-
* blocks and we must accept those blocks.
46-
*/
47-
static const unsigned int STANDARD_SCRIPT_VERIFY_FLAGS = MANDATORY_SCRIPT_VERIFY_FLAGS |
48-
SCRIPT_VERIFY_DERSIG |
49-
SCRIPT_VERIFY_STRICTENC |
50-
SCRIPT_VERIFY_MINIMALDATA |
51-
SCRIPT_VERIFY_NULLDUMMY |
52-
SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS |
53-
SCRIPT_VERIFY_CLEANSTACK |
54-
SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY;
55-
56-
/** For convenience, standard but not mandatory verify flags. */
57-
static const unsigned int STANDARD_NOT_MANDATORY_VERIFY_FLAGS = STANDARD_SCRIPT_VERIFY_FLAGS & ~MANDATORY_SCRIPT_VERIFY_FLAGS;
58-
5942
enum txnouttype
6043
{
6144
TX_NONSTANDARD,

0 commit comments

Comments
 (0)