~ubuntu-branches/debian/stretch/bitcoin/stretch

« back to all changes in this revision

Viewing changes to src/policy/policy.h

  • Committer: Package Import Robot
  • Author(s): Anthony Towns
  • Date: 2016-10-21 17:13:13 UTC
  • mfrom: (1.3.2)
  • Revision ID: package-import@ubuntu.com-20161021171313-7eu2ltpbk0xag3q1
Tags: 0.13.0-0.1
* Non-maintainer upload.
* New upstream release.
* Allow compilation with gcc/g++ 6. (Closes: Bug#835963)
* Additional fixes for openssl 1.1 compatibility. (See Bug#828248)
* Check if -latomic is needed (it is on mips*).
* Remove reproducible build patch, since leveldb build system is
  no longer used in 0.13. (See Bug#791834)
* Update description since the blockchain is much more than "several GB"
  now. (Closes: Bug#835809)

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
 
15
15
class CCoinsViewCache;
16
16
 
17
 
/** Default for -blockmaxsize and -blockminsize, which control the range of sizes the mining code will create **/
 
17
/** Default for -blockmaxsize, which controls the maximum size of block the mining code will create **/
18
18
static const unsigned int DEFAULT_BLOCK_MAX_SIZE = 750000;
19
 
static const unsigned int DEFAULT_BLOCK_MIN_SIZE = 0;
20
19
/** Default for -blockprioritysize, maximum space for zero/low-fee transactions **/
21
20
static const unsigned int DEFAULT_BLOCK_PRIORITY_SIZE = 0;
22
 
/** The maximum size for transactions we're willing to relay/mine */
23
 
static const unsigned int MAX_STANDARD_TX_SIZE = 100000;
 
21
/** Default for -blockmaxweight, which controls the range of block weights the mining code will create **/
 
22
static const unsigned int DEFAULT_BLOCK_MAX_WEIGHT = 3000000;
 
23
/** The maximum weight for transactions we're willing to relay/mine */
 
24
static const unsigned int MAX_STANDARD_TX_WEIGHT = 400000;
24
25
/** Maximum number of signature check operations in an IsStandard() P2SH script */
25
26
static const unsigned int MAX_P2SH_SIGOPS = 15;
26
27
/** The maximum number of sigops we're willing to relay/mine in a single tx */
27
 
static const unsigned int MAX_STANDARD_TX_SIGOPS = MAX_BLOCK_SIGOPS/5;
 
28
static const unsigned int MAX_STANDARD_TX_SIGOPS_COST = MAX_BLOCK_SIGOPS_COST/5;
28
29
/** Default for -maxmempool, maximum megabytes of mempool memory usage */
29
30
static const unsigned int DEFAULT_MAX_MEMPOOL_SIZE = 300;
 
31
/** Default for -bytespersigop */
 
32
static const unsigned int DEFAULT_BYTES_PER_SIGOP = 20;
30
33
/**
31
34
 * Standard script verification flags that standard transactions will comply
32
35
 * with. However scripts violating these flags may still be present in valid
41
44
                                                         SCRIPT_VERIFY_CLEANSTACK |
42
45
                                                         SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY |
43
46
                                                         SCRIPT_VERIFY_CHECKSEQUENCEVERIFY |
44
 
                                                         SCRIPT_VERIFY_LOW_S;
 
47
                                                         SCRIPT_VERIFY_LOW_S |
 
48
                                                         SCRIPT_VERIFY_WITNESS |
 
49
                                                         SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_WITNESS_PROGRAM;
45
50
 
46
51
/** For convenience, standard but not mandatory verify flags. */
47
52
static const unsigned int STANDARD_NOT_MANDATORY_VERIFY_FLAGS = STANDARD_SCRIPT_VERIFY_FLAGS & ~MANDATORY_SCRIPT_VERIFY_FLAGS;
50
55
static const unsigned int STANDARD_LOCKTIME_VERIFY_FLAGS = LOCKTIME_VERIFY_SEQUENCE |
51
56
                                                           LOCKTIME_MEDIAN_TIME_PAST;
52
57
 
53
 
bool IsStandard(const CScript& scriptPubKey, txnouttype& whichType);
 
58
bool IsStandard(const CScript& scriptPubKey, txnouttype& whichType, const bool witnessEnabled = false);
54
59
    /**
55
60
     * Check for standard transaction types
56
61
     * @return True if all outputs (scriptPubKeys) use only standard transaction forms
57
62
     */
58
 
bool IsStandardTx(const CTransaction& tx, std::string& reason);
 
63
bool IsStandardTx(const CTransaction& tx, std::string& reason, const bool witnessEnabled = false);
59
64
    /**
60
65
     * Check for standard transaction types
61
66
     * @param[in] mapInputs    Map of previous transactions that have outputs we're spending
63
68
     */
64
69
bool AreInputsStandard(const CTransaction& tx, const CCoinsViewCache& mapInputs);
65
70
 
 
71
extern unsigned int nBytesPerSigOp;
 
72
 
 
73
/** Compute the virtual transaction size (weight reinterpreted as bytes). */
 
74
int64_t GetVirtualTransactionSize(int64_t nWeight, int64_t nSigOpCost);
 
75
int64_t GetVirtualTransactionSize(const CTransaction& tx, int64_t nSigOpCost = 0);
 
76
 
66
77
#endif // BITCOIN_POLICY_POLICY_H