Fabcoin Core  0.16.2
P2P Digital Currency
standard.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_SCRIPT_STANDARD_H
7 #define FABCOIN_SCRIPT_STANDARD_H
8 
9 #include "script/interpreter.h"
10 #include "uint256.h"
11 
12 #include <boost/variant.hpp>
13 
14 #include <stdint.h>
15 
16 static const bool DEFAULT_ACCEPT_DATACARRIER = true;
17 
18 //contract executions with less gas than this are not standard
19 //Make sure is always equal or greater than MINIMUM_GAS_LIMIT (which we can't reference here due to insane header dependency chains)
20 static const uint64_t STANDARD_MINIMUM_GAS_LIMIT = 10000;
21 //contract executions with a price cheaper than this (in lius) are not standard
22 //TODO this needs to be controlled by DGP and needs to be propogated from consensus parameters
23 static const uint64_t STANDARD_MINIMUM_GAS_PRICE = 1;
24 class CKeyID;
25 class CScript;
26 
28 class CScriptID : public uint160
29 {
30 public:
31  CScriptID() : uint160() {}
32  CScriptID(const CScript& in);
33  CScriptID(const uint160& in) : uint160(in) {}
34 };
35 
36 static const unsigned int MAX_OP_RETURN_RELAY = 83;
37 extern bool fAcceptDatacarrier;
38 extern unsigned nMaxDatacarrierBytes;
39 
49 static const unsigned int MANDATORY_SCRIPT_VERIFY_FLAGS = SCRIPT_VERIFY_P2SH;
50 
52 {
54  // 'standard' transaction types:
64 };
65 
67 public:
68  friend bool operator==(const CNoDestination &a, const CNoDestination &b) { return true; }
69  friend bool operator<(const CNoDestination &a, const CNoDestination &b) { return true; }
70 };
71 
79 typedef boost::variant<CNoDestination, CKeyID, CScriptID> CTxDestination;
80 
81 const char* GetTxnOutputType(txnouttype t);
82 
83 bool Solver(const CScript& scriptPubKey, txnouttype& typeRet, std::vector<std::vector<unsigned char> >& vSolutionsRet, bool contractConsensus=false);
84 bool ExtractDestination(const CScript& scriptPubKey, CTxDestination& addressRet, txnouttype* typeRet = nullptr);
85 bool ExtractDestinations(const CScript& scriptPubKey, txnouttype& typeRet, std::vector<CTxDestination>& addressRet, int& nRequiredRet);
86 
89 CScript GetScriptForMultisig(int nRequired, const std::vector<CPubKey>& keys);
90 CScript GetScriptForWitness(const CScript& redeemscript);
91 
92 #endif // FABCOIN_SCRIPT_STANDARD_H
boost::variant< CNoDestination, CKeyID, CScriptID > CTxDestination
A txout script template with a specific destination.
Definition: standard.h:79
CScript GetScriptForRawPubKey(const CPubKey &pubkey)
Definition: standard.cpp:378
bool Solver(const CScript &scriptPubKey, txnouttype &typeRet, std::vector< std::vector< unsigned char > > &vSolutionsRet, bool contractConsensus=false)
Return public keys or hashes from scriptPubKey, for &#39;standard&#39; transaction types. ...
Definition: standard.cpp:46
friend bool operator==(const CNoDestination &a, const CNoDestination &b)
Definition: standard.h:68
CScriptID()
Definition: standard.h:31
#define a(i)
friend bool operator<(const CNoDestination &a, const CNoDestination &b)
Definition: standard.h:69
CScript GetScriptForWitness(const CScript &redeemscript)
Definition: standard.cpp:394
An encapsulated public key.
Definition: pubkey.h:39
CScript GetScriptForMultisig(int nRequired, const std::vector< CPubKey > &keys)
Definition: standard.cpp:383
bool fAcceptDatacarrier
Definition: standard.cpp:20
#define b(i, j)
CScriptID(const uint160 &in)
Definition: standard.h:33
txnouttype
Definition: standard.h:51
CScript GetScriptForDestination(const CTxDestination &dest)
Definition: standard.cpp:370
Serialized script, used inside transaction inputs and outputs.
Definition: script.h:417
A reference to a CKey: the Hash160 of its serialized public key.
Definition: pubkey.h:29
160-bit opaque blob.
Definition: uint256.h:120
A reference to a CScript: the Hash160 of its serialization (see script.h)
Definition: standard.h:28
const char * GetTxnOutputType(txnouttype t)
Definition: standard.cpp:25
unsigned nMaxDatacarrierBytes
Definition: standard.cpp:21
bool ExtractDestinations(const CScript &scriptPubKey, txnouttype &typeRet, std::vector< CTxDestination > &addressRet, int &nRequiredRet)
Definition: standard.cpp:302
bool ExtractDestination(const CScript &scriptPubKey, CTxDestination &addressRet, txnouttype *typeRet=nullptr)
Definition: standard.cpp:268