PIVX Core  5.6.99
P2P Digital Currency
policy.h
Go to the documentation of this file.
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 PIVX_POLICY_POLICY_H
7 #define PIVX_POLICY_POLICY_H
8 
9 #include "consensus/consensus.h"
10 #include "feerate.h"
11 #include "script/interpreter.h"
12 #include "script/standard.h"
13 
14 #include <string>
15 
16 class CChainParams;
17 class CCoinsViewCache;
18 class CTxOut;
19 
21 static const unsigned int DEFAULT_BLOCK_MAX_SIZE = 750000;
23 static const unsigned int MAX_P2SH_SIGOPS = 15;
25 static const unsigned int DEFAULT_MAX_MEMPOOL_SIZE = 300;
27 static const bool DEFAULT_PERMIT_BAREMULTISIG = true;
28 extern bool fIsBareMultisigStd;
34 static const unsigned int DUST_RELAY_TX_FEE = 30000;
35 
41 static constexpr unsigned int STANDARD_SCRIPT_VERIFY_FLAGS = MANDATORY_SCRIPT_VERIFY_FLAGS |
50 
52 static constexpr unsigned int STANDARD_NOT_MANDATORY_VERIFY_FLAGS = STANDARD_SCRIPT_VERIFY_FLAGS & ~MANDATORY_SCRIPT_VERIFY_FLAGS;
53 
54 // Sanity check the magic numbers when we change them
55 BOOST_STATIC_ASSERT(DEFAULT_BLOCK_MAX_SIZE <= MAX_BLOCK_SIZE_CURRENT);
56 
57 CAmount GetDustThreshold(const CTxOut& txout, const CFeeRate& dustRelayFeeIn);
58 
59 bool IsDust(const CTxOut& txout, const CFeeRate& dustRelayFeeIn);
60 
61 CAmount GetDustThreshold(const CFeeRate& dustRelayFeeIn);
62 CAmount GetShieldedDustThreshold(const CFeeRate& dustRelayFeeIn);
63 
64 bool IsStandard(const CScript& scriptPubKey, txnouttype& whichType);
65 
69 bool IsStandardTx(const CTransactionRef& tx, int nBlockHeight, std::string& reason);
70 
76 bool AreInputsStandard(const CTransaction& tx, const CCoinsViewCache& mapInputs);
77 
78 extern CFeeRate dustRelayFee;
79 
80 #endif // PIVX_POLICY_POLICY_H
int64_t CAmount
Amount in PIV (Can be negative)
Definition: amount.h:13
CChainParams defines various tweakable parameters of a given instance of the PIVX system.
Definition: chainparams.h:43
CCoinsView that adds a memory cache for transactions to another CCoinsView.
Definition: coins.h:283
Fee rate in PIV per kilobyte: CAmount / kB.
Definition: feerate.h:20
Serialized script, used inside transaction inputs and outputs.
Definition: script.h:381
The basic transaction that is broadcasted on the network and contained in blocks.
Definition: transaction.h:244
An output of a transaction.
Definition: transaction.h:137
CScript scriptPubKey
Definition: transaction.h:140
@ SCRIPT_VERIFY_NULLDUMMY
Definition: interpreter.h:51
@ SCRIPT_VERIFY_LOW_S
Definition: interpreter.h:48
@ SCRIPT_VERIFY_STRICTENC
Definition: interpreter.h:41
@ SCRIPT_VERIFY_DERSIG
Definition: interpreter.h:44
@ SCRIPT_VERIFY_CLEANSTACK
Definition: interpreter.h:78
@ SCRIPT_VERIFY_MINIMALDATA
Definition: interpreter.h:61
@ SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS
Definition: interpreter.h:71
@ SCRIPT_VERIFY_EXCHANGEADDR
Definition: interpreter.h:87
BOOST_STATIC_ASSERT(DEFAULT_BLOCK_MAX_SIZE<=MAX_BLOCK_SIZE_CURRENT)
bool AreInputsStandard(const CTransaction &tx, const CCoinsViewCache &mapInputs)
Check for standard transaction types.
Definition: policy.cpp:191
CAmount GetDustThreshold(const CTxOut &txout, const CFeeRate &dustRelayFeeIn)
Definition: policy.cpp:21
bool IsStandardTx(const CTransactionRef &tx, int nBlockHeight, std::string &reason)
Check for standard transaction types.
Definition: policy.cpp:100
bool IsDust(const CTxOut &txout, const CFeeRate &dustRelayFeeIn)
Definition: policy.cpp:45
bool IsStandard(const CScript &scriptPubKey, txnouttype &whichType)
Check transaction inputs to mitigate two potential denial-of-service attacks:
Definition: policy.cpp:78
CAmount GetShieldedDustThreshold(const CFeeRate &dustRelayFeeIn)
Definition: policy.cpp:50
bool fIsBareMultisigStd
Definition: policy.cpp:17
CFeeRate dustRelayFee
Definition: policy.cpp:19
txnouttype
Definition: standard.h:46
std::shared_ptr< const CTransaction > CTransactionRef
Definition: transaction.h:456