mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 23:18:14 +01:00
Separate script/standard
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
#include "key.h"
|
||||
#include "script/script.h"
|
||||
#include "script/interpreter.h"
|
||||
#include "script/standard.h"
|
||||
|
||||
#include <stdexcept>
|
||||
#include <stdint.h>
|
||||
@@ -19,8 +20,6 @@ class CKeyStore;
|
||||
class CTransaction;
|
||||
struct CMutableTransaction;
|
||||
|
||||
static const unsigned int MAX_OP_RETURN_RELAY = 40; // bytes
|
||||
|
||||
/** IsMine() return codes */
|
||||
enum isminetype
|
||||
{
|
||||
@@ -32,38 +31,6 @@ enum isminetype
|
||||
/** used for bitflags of isminetype */
|
||||
typedef uint8_t isminefilter;
|
||||
|
||||
// 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;
|
||||
|
||||
// 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_STRICTENC |
|
||||
SCRIPT_VERIFY_NULLDUMMY;
|
||||
|
||||
// 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;
|
||||
|
||||
enum txnouttype
|
||||
{
|
||||
TX_NONSTANDARD,
|
||||
// 'standard' transaction types:
|
||||
TX_PUBKEY,
|
||||
TX_PUBKEYHASH,
|
||||
TX_SCRIPTHASH,
|
||||
TX_MULTISIG,
|
||||
TX_NULL_DATA,
|
||||
};
|
||||
|
||||
const char* GetTxnOutputType(txnouttype t);
|
||||
|
||||
/** Compact serializer for scripts.
|
||||
*
|
||||
* It detects common cases and encodes them much more efficiently.
|
||||
@@ -137,14 +104,9 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
bool Solver(const CScript& scriptPubKey, txnouttype& typeRet, std::vector<std::vector<unsigned char> >& vSolutionsRet);
|
||||
int ScriptSigArgsExpected(txnouttype t, const std::vector<std::vector<unsigned char> >& vSolutions);
|
||||
bool IsStandard(const CScript& scriptPubKey, txnouttype& whichType);
|
||||
isminetype IsMine(const CKeyStore& keystore, const CScript& scriptPubKey);
|
||||
isminetype IsMine(const CKeyStore& keystore, const CTxDestination& dest);
|
||||
void ExtractAffectedKeys(const CKeyStore &keystore, const CScript& scriptPubKey, std::vector<CKeyID> &vKeys);
|
||||
bool ExtractDestination(const CScript& scriptPubKey, CTxDestination& addressRet);
|
||||
bool ExtractDestinations(const CScript& scriptPubKey, txnouttype& typeRet, std::vector<CTxDestination>& addressRet, int& nRequiredRet);
|
||||
bool SignSignature(const CKeyStore& keystore, const CScript& fromPubKey, CMutableTransaction& txTo, unsigned int nIn, int nHashType=SIGHASH_ALL);
|
||||
bool SignSignature(const CKeyStore& keystore, const CTransaction& txFrom, CMutableTransaction& txTo, unsigned int nIn, int nHashType=SIGHASH_ALL);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user