Files

86 lines
3.6 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 developers
2021-03-13 13:47:44 +01:00
* Copyright (C) 2019-2021 Tom Zander <tom@flowee.org>
2017-11-09 19:34:51 +01:00
*
* 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/>.
*/
2018-01-16 10:47:52 +00:00
#ifndef FLOWEE_POLICY_POLICY_H
#define FLOWEE_POLICY_POLICY_H
#include "consensus/consensus.h"
#include "script/interpreter.h"
#include "script/standard.h"
2014-10-11 22:41:05 +00:00
#include <string>
class Tx;
class UnspentOutputDatabase;
2014-10-11 22:41:05 +00:00
/** The maximum size for transactions we're willing to relay/mine */
static const unsigned int MAX_STANDARD_TX_SIZE = 100000;
/**
* Standard script verification flags that standard transactions will comply
* with. However scripts violating these flags may still be present in valid
* blocks and we must accept those blocks.
*/
static const unsigned int STANDARD_SCRIPT_VERIFY_FLAGS = MANDATORY_SCRIPT_VERIFY_FLAGS |
SCRIPT_VERIFY_DERSIG |
SCRIPT_VERIFY_STRICTENC |
SCRIPT_VERIFY_MINIMALDATA |
SCRIPT_VERIFY_NULLDUMMY |
SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS |
SCRIPT_VERIFY_CLEANSTACK |
SCRIPT_VERIFY_NULLFAIL |
SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY |
2015-09-25 16:18:51 -07:00
SCRIPT_VERIFY_CHECKSEQUENCEVERIFY |
SCRIPT_VERIFY_LOW_S;
/** For convenience, standard but not mandatory verify flags. */
static const unsigned int STANDARD_NOT_MANDATORY_VERIFY_FLAGS = STANDARD_SCRIPT_VERIFY_FLAGS & ~MANDATORY_SCRIPT_VERIFY_FLAGS;
2016-02-11 15:34:04 -05:00
/** Used as the flags parameter to sequence and nLocktime checks in non-consensus code. */
2015-12-07 15:44:16 -05:00
static const unsigned int STANDARD_LOCKTIME_VERIFY_FLAGS = LOCKTIME_VERIFY_SEQUENCE |
LOCKTIME_MEDIAN_TIME_PAST;
2015-11-03 17:12:36 +00:00
2021-03-13 13:47:44 +01:00
/// \internal. Only here for unit tests.
2026-05-07 15:55:57 +02:00
bool IsStandard(const CScript &scriptPubKey, Script::TxnOutType &whichType, int &dataUsed);
2014-10-11 22:41:05 +00:00
/**
* Check for standard transaction types
* @return True if all outputs (scriptPubKeys) use only standard transaction forms
*/
2026-05-07 15:55:57 +02:00
bool IsStandardTx(const CTransaction& tx, std::string& reason);
2014-10-11 22:41:05 +00:00
namespace Policy {
2020-04-12 23:48:32 +02:00
constexpr unsigned int MAX_SIGCHEKCS_PER_TX = 3000;
std::int32_t blockSizeAcceptLimit();
2020-04-12 23:48:32 +02:00
uint32_t blockSigCheckAcceptLimit();
/**
* Check for standard transaction types
* @return True if input use standard transaction forms
*/
2026-05-07 15:55:57 +02:00
bool isInputStandard(const CScript &outputScript, const CScript &inputScript);
/**
* Check for standard transaction types
* @return True if all inputs use only standard transaction forms
*/
bool areInputsStandard(const Tx &tx, const UnspentOutputDatabase *utxo);
}
2018-01-16 10:47:52 +00:00
#endif