Files
thehub/hub/server/policy/policy.h
tomFlowee cd317bc3c0 Cleanup p2sh32
The activation is past and there is no point in having a flag passed
through a dozen methods in order to detect when to enable it.
Because it is always enabled.
2026-05-07 16:15:26 +02:00

86 lines
3.6 KiB
C++

/*
* This file is part of the Flowee project
* Copyright (C) 2009-2010 Satoshi Nakamoto
* Copyright (C) 2009-2015 The Bitcoin developers
* Copyright (C) 2019-2021 Tom Zander <tom@flowee.org>
*
* 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_POLICY_POLICY_H
#define FLOWEE_POLICY_POLICY_H
#include "consensus/consensus.h"
#include "script/interpreter.h"
#include "script/standard.h"
#include <string>
class Tx;
class UnspentOutputDatabase;
/** 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 |
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;
/** Used as the flags parameter to sequence and nLocktime checks in non-consensus code. */
static const unsigned int STANDARD_LOCKTIME_VERIFY_FLAGS = LOCKTIME_VERIFY_SEQUENCE |
LOCKTIME_MEDIAN_TIME_PAST;
/// \internal. Only here for unit tests.
bool IsStandard(const CScript &scriptPubKey, Script::TxnOutType &whichType, int &dataUsed);
/**
* Check for standard transaction types
* @return True if all outputs (scriptPubKeys) use only standard transaction forms
*/
bool IsStandardTx(const CTransaction& tx, std::string& reason);
namespace Policy {
constexpr unsigned int MAX_SIGCHEKCS_PER_TX = 3000;
std::int32_t blockSizeAcceptLimit();
uint32_t blockSigCheckAcceptLimit();
/**
* Check for standard transaction types
* @return True if input use standard transaction forms
*/
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);
}
#endif