LCOV - code coverage report
Current view: top level - src/script - standard.h (source / functions) Hit Total Coverage
Test: total_coverage.info Lines: 2 4 50.0 %
Date: 2015-10-12 22:39:14 Functions: 0 4 0.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.11