15
15
class CCoinsViewCache;
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;
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 |
48
SCRIPT_VERIFY_WITNESS |
49
SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_WITNESS_PROGRAM;
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;
53
bool IsStandard(const CScript& scriptPubKey, txnouttype& whichType);
58
bool IsStandard(const CScript& scriptPubKey, txnouttype& whichType, const bool witnessEnabled = false);
55
60
* Check for standard transaction types
56
61
* @return True if all outputs (scriptPubKeys) use only standard transaction forms
58
bool IsStandardTx(const CTransaction& tx, std::string& reason);
63
bool IsStandardTx(const CTransaction& tx, std::string& reason, const bool witnessEnabled = false);
60
65
* Check for standard transaction types
61
66
* @param[in] mapInputs Map of previous transactions that have outputs we're spending
64
69
bool AreInputsStandard(const CTransaction& tx, const CCoinsViewCache& mapInputs);
71
extern unsigned int nBytesPerSigOp;
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);
66
77
#endif // BITCOIN_POLICY_POLICY_H