68 lines
2.5 KiB
C++
68 lines
2.5 KiB
C++
/*
|
|
* This file is part of the Flowee project
|
|
* Copyright (C) 2009-2010 Satoshi Nakamoto
|
|
* Copyright (C) 2009-2015 The Bitcoin Core developers
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#ifndef FLOWEE_SCRIPT_STANDARD_H
|
|
#define FLOWEE_SCRIPT_STANDARD_H
|
|
|
|
#include <primitives/script.h>
|
|
#include <script/interpreter.h>
|
|
#include <boost/variant.hpp>
|
|
|
|
class KeyId;
|
|
class CScript;
|
|
class CScriptID;
|
|
|
|
extern bool fAcceptDatacarrier;
|
|
extern int nMaxDatacarrierBytes;
|
|
|
|
/**
|
|
* Mandatory script verification flags that all new blocks must comply with for
|
|
* them to be valid. (but old blocks may not comply with) Currently just P2SH,
|
|
* but in the future other flags may be added, such as a soft-fork to enforce
|
|
* strict DER encoding.
|
|
*
|
|
* Failing one of these tests may trigger a DoS ban - see CheckInputs() for
|
|
* details.
|
|
*/
|
|
static const unsigned int MANDATORY_SCRIPT_VERIFY_FLAGS = SCRIPT_VERIFY_P2SH;
|
|
|
|
class CNoDestination {
|
|
public:
|
|
friend bool operator==(const CNoDestination &a, const CNoDestination &b) { return true; }
|
|
friend bool operator<(const CNoDestination &a, const CNoDestination &b) { return true; }
|
|
};
|
|
|
|
/**
|
|
* A txout script template with a specific destination. It is either:
|
|
* * CNoDestination: no destination set
|
|
* * KeyId: TX_PUBKEYHASH destination
|
|
* * CScriptID: TX_SCRIPTHASH destination
|
|
* A CTxDestination is the internal data type encoded in a CBitcoinAddress
|
|
*/
|
|
typedef boost::variant<CNoDestination, KeyId, CScriptID> CTxDestination;
|
|
|
|
bool ExtractDestination(const CScript& scriptPubKey, CTxDestination& addressRet);
|
|
bool ExtractDestinations(const CScript& scriptPubKey, Script::TxnOutType& typeRet, std::vector<CTxDestination>& addressRet, int& nRequiredRet);
|
|
|
|
CScript GetScriptForDestination(const CTxDestination& dest);
|
|
CScript GetScriptForRawPubKey(const PublicKey& pubkey);
|
|
CScript GetScriptForMultisig(int nRequired, const std::vector<PublicKey>& keys);
|
|
|
|
#endif
|