Raven Core  3.0.0
P2P Digital Currency
policy.h
Go to the documentation of this file.
1 // Copyright (c) 2009-2010 Satoshi Nakamoto
2 // Copyright (c) 2009-2016 The Bitcoin Core developers
3 // Copyright (c) 2017-2019 The Raven Core developers
4 // Distributed under the MIT software license, see the accompanying
5 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
6 
7 #ifndef RAVEN_POLICY_POLICY_H
8 #define RAVEN_POLICY_POLICY_H
9 
10 #include "consensus/consensus.h"
11 #include "feerate.h"
12 #include "script/interpreter.h"
13 #include "script/standard.h"
14 
15 #include <string>
16 
17 class CCoinsViewCache;
18 class CTxOut;
19 
21 // Deprecated with RIP2 implementation
22 //static const unsigned int DEFAULT_BLOCK_MAX_WEIGHT = MAX_BLOCK_WEIGHT - 4000;
24 static const unsigned int DEFAULT_BLOCK_MIN_TX_FEE = 1000;
26 static const unsigned int MAX_STANDARD_TX_WEIGHT = 400000;
28 static const unsigned int MAX_P2SH_SIGOPS = 15;
30 static const unsigned int MAX_STANDARD_TX_SIGOPS_COST = MAX_BLOCK_SIGOPS_COST/5;
32 static const unsigned int DEFAULT_MAX_MEMPOOL_SIZE = 300;
34 static const unsigned int DEFAULT_INCREMENTAL_RELAY_FEE = 1000;
36 static const unsigned int DEFAULT_BYTES_PER_SIGOP = 20;
38 static const unsigned int MAX_STANDARD_P2WSH_STACK_ITEMS = 100;
40 static const unsigned int MAX_STANDARD_P2WSH_STACK_ITEM_SIZE = 80;
42 static const unsigned int MAX_STANDARD_P2WSH_SCRIPT_SIZE = 3600;
48 static const unsigned int DUST_RELAY_TX_FEE = 3000;
54 static const unsigned int STANDARD_SCRIPT_VERIFY_FLAGS = MANDATORY_SCRIPT_VERIFY_FLAGS |
69 
71 static const unsigned int STANDARD_NOT_MANDATORY_VERIFY_FLAGS = STANDARD_SCRIPT_VERIFY_FLAGS & ~MANDATORY_SCRIPT_VERIFY_FLAGS;
72 
74 static const unsigned int STANDARD_LOCKTIME_VERIFY_FLAGS = LOCKTIME_VERIFY_SEQUENCE |
76 
78 
79 bool IsDust(const CTxOut& txout, const CFeeRate& dustRelayFee);
80 
81 bool IsStandard(const CScript& scriptPubKey, txnouttype& whichType, const bool witnessEnabled = false);
86 bool IsStandardTx(const CTransaction& tx, std::string& reason, const bool witnessEnabled = false);
92 bool AreInputsStandard(const CTransaction& tx, const CCoinsViewCache& mapInputs);
98 bool IsWitnessStandard(const CTransaction& tx, const CCoinsViewCache& mapInputs);
99 
101 extern CFeeRate dustRelayFee;
102 extern unsigned int nBytesPerSigOp;
103 
105 int64_t GetVirtualTransactionSize(int64_t nWeight, int64_t nSigOpCost);
106 int64_t GetVirtualTransactionSize(const CTransaction& tx, int64_t nSigOpCost = 0);
107 
108 #endif // RAVEN_POLICY_POLICY_H
CFeeRate incrementalRelayFee
Definition: policy.cpp:262
CScript scriptPubKey
Definition: transaction.h:141
bool IsStandard(const CScript &scriptPubKey, txnouttype &whichType, const bool witnessEnabled=false)
Definition: policy.cpp:62
bool IsStandardTx(const CTransaction &tx, std::string &reason, const bool witnessEnabled=false)
Check for standard transaction types.
Definition: policy.cpp:87
CAmount GetDustThreshold(const CTxOut &txout, const CFeeRate &dustRelayFee)
Definition: policy.cpp:19
CFeeRate dustRelayFee
Definition: policy.cpp:263
bool IsDust(const CTxOut &txout, const CFeeRate &dustRelayFee)
Definition: policy.cpp:53
int64_t CAmount
Amount in corbies (Can be negative)
Definition: amount.h:13
An output of a transaction.
Definition: transaction.h:137
txnouttype
Definition: standard.h:57
int64_t GetVirtualTransactionSize(int64_t nWeight, int64_t nSigOpCost)
Compute the virtual transaction size (weight reinterpreted as bytes).
Definition: policy.cpp:266
Serialized script, used inside transaction inputs and outputs.
Definition: script.h:396
Fee rate in satoshis per kilobyte: CAmount / kB.
Definition: feerate.h:20
unsigned int nBytesPerSigOp
Definition: policy.cpp:264
The basic transaction that is broadcasted on the network and contained in blocks. ...
Definition: transaction.h:270
CCoinsView that adds a memory cache for transactions to another CCoinsView.
Definition: coins.h:208
bool AreInputsStandard(const CTransaction &tx, const CCoinsViewCache &mapInputs)
Check for standard transaction types.
Definition: policy.cpp:176
bool IsWitnessStandard(const CTransaction &tx, const CCoinsViewCache &mapInputs)
Check if the transaction is over standard P2WSH resources limit: 3600bytes witnessScript size...
Definition: policy.cpp:210