LCOV - code coverage report
Current view: top level - src/script - standard.h (source / functions) Hit Total Coverage
Test: bitcoincash_test.info Lines: 1 1 100.0 %
Date: 2018-04-13 15:12:50 Functions: 0 0 -

          Line data    Source code
       1             : // Copyright (c) 2009-2010 Satoshi Nakamoto
       2             : // Copyright (c) 2009-2016 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 BITCOIN_SCRIPT_STANDARD_H
       7             : #define BITCOIN_SCRIPT_STANDARD_H
       8             : 
       9             : #include "script/interpreter.h"
      10             : #include "uint256.h"
      11             : 
      12             : #include <boost/variant.hpp>
      13             : 
      14             : #include <cstdint>
      15             : 
      16             : static const bool DEFAULT_ACCEPT_DATACARRIER = true;
      17             : 
      18             : class CKeyID;
      19             : class CScript;
      20             : 
      21             : /** A reference to a CScript: the Hash160 of its serialization (see script.h) */
      22             : class CScriptID : public uint160 {
      23             : public:
      24             :     CScriptID() : uint160() {}
      25             :     CScriptID(const CScript &in);
      26        5018 :     CScriptID(const uint160 &in) : uint160(in) {}
      27             : };
      28             : 
      29             : //!< bytes (+1 for OP_RETURN, +2 for the pushdata opcodes)
      30             : static const unsigned int MAX_OP_RETURN_RELAY = 83;
      31             : static const unsigned int MAX_OP_RETURN_RELAY_LARGE = 223;
      32             : extern bool fAcceptDatacarrier;
      33             : 
      34             : /**
      35             :  * Mandatory script verification flags that all new blocks must comply with for
      36             :  * them to be valid. (but old blocks may not comply with) Currently just P2SH,
      37             :  * but in the future other flags may be added, such as a soft-fork to enforce
      38             :  * strict DER encoding.
      39             :  *
      40             :  * Failing one of these tests may trigger a DoS ban - see CheckInputs() for
      41             :  * details.
      42             :  */
      43             : static const uint32_t MANDATORY_SCRIPT_VERIFY_FLAGS =
      44             :     SCRIPT_VERIFY_P2SH | SCRIPT_VERIFY_STRICTENC |
      45             :     SCRIPT_ENABLE_SIGHASH_FORKID | SCRIPT_VERIFY_LOW_S | SCRIPT_VERIFY_NULLFAIL;
      46             : 
      47             : enum txnouttype {
      48             :     TX_NONSTANDARD,
      49             :     // 'standard' transaction types:
      50             :     TX_PUBKEY,
      51             :     TX_PUBKEYHASH,
      52             :     TX_SCRIPTHASH,
      53             :     TX_MULTISIG,
      54             :     TX_NULL_DATA,
      55             : };
      56             : 
      57             : class CNoDestination {
      58             : public:
      59             :     friend bool operator==(const CNoDestination &a, const CNoDestination &b) {
      60             :         return true;
      61             :     }
      62             :     friend bool operator<(const CNoDestination &a, const CNoDestination &b) {
      63             :         return true;
      64             :     }
      65             : };
      66             : 
      67             : /**
      68             :  * A txout script template with a specific destination. It is either:
      69             :  *  * CNoDestination: no destination set
      70             :  *  * CKeyID: TX_PUBKEYHASH destination
      71             :  *  * CScriptID: TX_SCRIPTHASH destination
      72             :  *  A CTxDestination is the internal data type encoded in a bitcoin address
      73             :  */
      74             : typedef boost::variant<CNoDestination, CKeyID, CScriptID> CTxDestination;
      75             : 
      76             : const char *GetTxnOutputType(txnouttype t);
      77             : bool IsValidDestination(const CTxDestination &dest);
      78             : 
      79             : bool Solver(const CScript &scriptPubKey, txnouttype &typeRet,
      80             :             std::vector<std::vector<uint8_t>> &vSolutionsRet);
      81             : bool ExtractDestination(const CScript &scriptPubKey,
      82             :                         CTxDestination &addressRet);
      83             : bool ExtractDestinations(const CScript &scriptPubKey, txnouttype &typeRet,
      84             :                          std::vector<CTxDestination> &addressRet,
      85             :                          int &nRequiredRet);
      86             : 
      87             : CScript GetScriptForDestination(const CTxDestination &dest);
      88             : CScript GetScriptForRawPubKey(const CPubKey &pubkey);
      89             : CScript GetScriptForMultisig(int nRequired, const std::vector<CPubKey> &keys);
      90             : 
      91             : #endif // BITCOIN_SCRIPT_STANDARD_H

Generated by: LCOV version 1.12