Fabcoin Core  0.16.2
P2P Digital Currency
policy.h
Go to the documentation of this file.
1 // Copyright (c) 2009-2010 Satoshi Nakamoto
2 // Copyright (c) 2009-2017 The Bitcoin Core 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 FABCOIN_POLICY_POLICY_H
7 #define FABCOIN_POLICY_POLICY_H
8 
9 #include <consensus/consensus.h>
10 #include <policy/feerate.h>
11 #include <script/interpreter.h>
12 #include <script/standard.h>
13 
14 #include <string>
15 
16 class CCoinsViewCache;
17 class CTxOut;
18 
19 
20 static const unsigned int DEFAULT_BLOCK_MAX_CONFLICT = 30;
22 static const unsigned int DEFAULT_BLOCK_PRIORITY_SIZE = 0;
24 static const unsigned int DEFAULT_BLOCK_MAX_WEIGHT = MAX_BLOCK_WEIGHT - 4000;
26 //??? static const unsigned int DEFAULT_BLOCK_MIN_TX_FEE = 400000;
27 static const unsigned int DEFAULT_BLOCK_MIN_TX_FEE = 1000;
29 //++static const unsigned int MAX_STANDARD_TX_WEIGHT = 4000000;
30 static const unsigned int MAX_STANDARD_TX_WEIGHT = 400000;
32 static const unsigned int MAX_P2SH_SIGOPS = 15;
34 extern unsigned int dgpMaxTxSigOps;
36 static const unsigned int MAX_STANDARD_TX_SIGOPS_COST = MAX_BLOCK_SIGOPS_COST/5;
38 static const unsigned int DEFAULT_MAX_MEMPOOL_SIZE = 300;
40 //??? static const unsigned int DEFAULT_INCREMENTAL_RELAY_FEE = 10000;
41 static const unsigned int DEFAULT_INCREMENTAL_RELAY_FEE = 1000;
43 static const unsigned int DEFAULT_BYTES_PER_SIGOP = 20;
45 static const unsigned int MAX_STANDARD_P2WSH_STACK_ITEMS = 100;
47 static const unsigned int MAX_STANDARD_P2WSH_STACK_ITEM_SIZE = 80;
49 static const unsigned int MAX_STANDARD_P2WSH_SCRIPT_SIZE = 3600;
55 //??? static const unsigned int DUST_RELAY_TX_FEE = 400000;
56 static const unsigned int DUST_RELAY_TX_FEE = 3000;
62 static const unsigned int STANDARD_SCRIPT_VERIFY_FLAGS = MANDATORY_SCRIPT_VERIFY_FLAGS |
77 
79 static const unsigned int STANDARD_NOT_MANDATORY_VERIFY_FLAGS = STANDARD_SCRIPT_VERIFY_FLAGS & ~MANDATORY_SCRIPT_VERIFY_FLAGS;
80 
82 static const unsigned int STANDARD_LOCKTIME_VERIFY_FLAGS = LOCKTIME_VERIFY_SEQUENCE |
84 
86 
87 bool IsDust(const CTxOut& txout, const CFeeRate& dustRelayFee);
88 
89 bool IsStandard(const CScript& scriptPubKey, txnouttype& whichType, const bool witnessEnabled = false);
94 bool IsStandardTx(const CTransaction& tx, std::string& reason, const bool witnessEnabled = false);
100 bool AreInputsStandard(const CTransaction& tx, const CCoinsViewCache& mapInputs);
106 bool IsWitnessStandard(const CTransaction& tx, const CCoinsViewCache& mapInputs);
107 
109 extern CFeeRate dustRelayFee;
110 extern unsigned int nBytesPerSigOp;
111 
113 int64_t GetVirtualTransactionSize(int64_t nWeight, int64_t nSigOpCost);
114 int64_t GetVirtualTransactionSize(const CTransaction& tx, int64_t nSigOpCost = 0);
115 
116 #endif // FABCOIN_POLICY_POLICY_H
CFeeRate incrementalRelayFee
Definition: policy.cpp:250
CScript scriptPubKey
Definition: transaction.h:135
bool IsStandard(const CScript &scriptPubKey, txnouttype &whichType, const bool witnessEnabled=false)
Check transaction inputs to mitigate two potential denial-of-service attacks:
Definition: policy.cpp:75
bool IsStandardTx(const CTransaction &tx, std::string &reason, const bool witnessEnabled=false)
Check for standard transaction types.
Definition: policy.cpp:100
CAmount GetDustThreshold(const CTxOut &txout, const CFeeRate &dustRelayFee)
Definition: policy.cpp:18
CFeeRate dustRelayFee
Definition: policy.cpp:251
unsigned int dgpMaxTxSigOps
The maximum number of sigops we&#39;re willing to relay/mine in a single tx.
Definition: consensus.cpp:19
bool IsDust(const CTxOut &txout, const CFeeRate &dustRelayFee)
Definition: policy.cpp:52
int64_t CAmount
Amount in lius (Can be negative)
Definition: amount.h:15
An output of a transaction.
Definition: transaction.h:131
txnouttype
Definition: standard.h:51
int64_t GetVirtualTransactionSize(int64_t nWeight, int64_t nSigOpCost)
Compute the virtual transaction size (weight reinterpreted as bytes).
Definition: policy.cpp:254
Serialized script, used inside transaction inputs and outputs.
Definition: script.h:417
Fee rate in liu per kilobyte: CAmount / kB.
Definition: feerate.h:20
unsigned int nBytesPerSigOp
Definition: policy.cpp:252
The basic transaction that is broadcasted on the network and contained in blocks. ...
Definition: transaction.h:275
CCoinsView that adds a memory cache for transactions to another CCoinsView.
Definition: coins.h:201
bool AreInputsStandard(const CTransaction &tx, const CCoinsViewCache &mapInputs)
Check for standard transaction types.
Definition: policy.cpp:164
bool IsWitnessStandard(const CTransaction &tx, const CCoinsViewCache &mapInputs)
Check if the transaction is over standard P2WSH resources limit: 3600bytes witnessScript size...
Definition: policy.cpp:198