Files

68 lines
2.5 KiB
C++
Raw Permalink Normal View History

2017-11-09 19:34:51 +01:00
/*
* 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/>.
*/
2014-08-23 03:35:51 +02:00
2018-01-16 10:47:52 +00:00
#ifndef FLOWEE_SCRIPT_STANDARD_H
#define FLOWEE_SCRIPT_STANDARD_H
2014-08-23 03:35:51 +02:00
2021-01-20 18:22:34 +01:00
#include <primitives/script.h>
2021-01-21 11:56:26 +01:00
#include <script/interpreter.h>
#include <boost/variant.hpp>
2022-07-06 21:52:47 +02:00
class KeyId;
class CScript;
class CScriptID;
extern bool fAcceptDatacarrier;
2021-03-13 13:47:44 +01:00
extern int nMaxDatacarrierBytes;
2014-08-23 03:35:51 +02:00
/**
* 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.
*/
2014-08-23 03:35:51 +02:00
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
2022-07-06 21:52:47 +02:00
* * KeyId: TX_PUBKEYHASH destination
* * CScriptID: TX_SCRIPTHASH destination
* A CTxDestination is the internal data type encoded in a CBitcoinAddress
*/
2022-07-06 21:52:47 +02:00
typedef boost::variant<CNoDestination, KeyId, CScriptID> CTxDestination;
2014-08-23 03:35:51 +02:00
bool ExtractDestination(const CScript& scriptPubKey, CTxDestination& addressRet);
2019-06-06 21:37:49 +02:00
bool ExtractDestinations(const CScript& scriptPubKey, Script::TxnOutType& typeRet, std::vector<CTxDestination>& addressRet, int& nRequiredRet);
2014-08-23 03:35:51 +02:00
CScript GetScriptForDestination(const CTxDestination& dest);
2022-07-06 21:56:34 +02:00
CScript GetScriptForRawPubKey(const PublicKey& pubkey);
CScript GetScriptForMultisig(int nRequired, const std::vector<PublicKey>& keys);
2018-01-16 10:47:52 +00:00
#endif