Bitcoin Core
31.1.0
P2P Digital Currency
Toggle main menu visibility
Loading...
Searching...
No Matches
src
script
solver.h
Go to the documentation of this file.
1
// Copyright (c) 2009-2010 Satoshi Nakamoto
2
// Copyright (c) 2009-present The Bitcoin Core developers
3
// Distributed under the MIT software license, see the accompanying
4
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
5
6
// The Solver functions are used by policy and the wallet, but not consensus.
7
8
#ifndef BITCOIN_SCRIPT_SOLVER_H
9
#define BITCOIN_SCRIPT_SOLVER_H
10
11
#include <
attributes.h
>
12
#include <
script/script.h
>
13
#include <
span.h
>
14
15
#include <string>
16
#include <optional>
17
#include <utility>
18
#include <vector>
19
20
class
CPubKey
;
21
22
enum class
TxoutType
{
23
NONSTANDARD
,
24
// 'standard' transaction types:
25
ANCHOR
,
26
PUBKEY
,
27
PUBKEYHASH
,
28
SCRIPTHASH
,
29
MULTISIG
,
30
NULL_DATA
,
31
WITNESS_V0_SCRIPTHASH
,
32
WITNESS_V0_KEYHASH
,
33
WITNESS_V1_TAPROOT
,
34
WITNESS_UNKNOWN
,
35
};
36
38
std::string
GetTxnOutputType
(
TxoutType
t
);
39
40
constexpr
bool
IsPushdataOp
(
opcodetype
opcode)
41
{
42
return
opcode >
OP_FALSE
&& opcode <=
OP_PUSHDATA4
;
43
}
44
55
TxoutType
Solver
(
const
CScript
& scriptPubKey, std::vector<std::vector<unsigned char>>& vSolutionsRet);
56
58
CScript
GetScriptForRawPubKey
(
const
CPubKey
& pubkey);
59
62
std::optional<std::pair<int, std::vector<std::span<const unsigned char>>>>
MatchMultiA
(
const
CScript
&
script
LIFETIMEBOUND
);
63
65
CScript
GetScriptForMultisig
(
int
nRequired,
const
std::vector<CPubKey>& keys);
66
67
#endif
// BITCOIN_SCRIPT_SOLVER_H
attributes.h
LIFETIMEBOUND
#define LIFETIMEBOUND
Definition
attributes.h:16
CPubKey
An encapsulated public key.
Definition
pubkey.h:34
CScript
Serialized script, used inside transaction inputs and outputs.
Definition
script.h:405
script
Definition
parsing.cpp:13
script.h
opcodetype
opcodetype
Script opcodes.
Definition
script.h:74
OP_PUSHDATA4
@ OP_PUSHDATA4
Definition
script.h:80
OP_FALSE
@ OP_FALSE
Definition
script.h:77
IsPushdataOp
constexpr bool IsPushdataOp(opcodetype opcode)
Definition
solver.h:40
Solver
TxoutType Solver(const CScript &scriptPubKey, std::vector< std::vector< unsigned char > > &vSolutionsRet)
Parse a scriptPubKey and identify script type for standard scripts.
Definition
solver.cpp:141
GetScriptForMultisig
CScript GetScriptForMultisig(int nRequired, const std::vector< CPubKey > &keys)
Generate a multisig script.
Definition
solver.cpp:218
GetScriptForRawPubKey
CScript GetScriptForRawPubKey(const CPubKey &pubkey)
Generate a P2PK script for the given pubkey.
Definition
solver.cpp:213
GetTxnOutputType
std::string GetTxnOutputType(TxoutType t)
Get the name of a TxoutType as a string.
Definition
solver.cpp:18
TxoutType
TxoutType
Definition
solver.h:22
TxoutType::WITNESS_V1_TAPROOT
@ WITNESS_V1_TAPROOT
Definition
solver.h:33
TxoutType::WITNESS_UNKNOWN
@ WITNESS_UNKNOWN
Only for Witness versions not already defined above.
Definition
solver.h:34
TxoutType::ANCHOR
@ ANCHOR
anyone can spend script
Definition
solver.h:25
TxoutType::WITNESS_V0_SCRIPTHASH
@ WITNESS_V0_SCRIPTHASH
Definition
solver.h:31
TxoutType::SCRIPTHASH
@ SCRIPTHASH
Definition
solver.h:28
TxoutType::PUBKEYHASH
@ PUBKEYHASH
Definition
solver.h:27
TxoutType::NULL_DATA
@ NULL_DATA
unspendable OP_RETURN script that carries data
Definition
solver.h:30
TxoutType::NONSTANDARD
@ NONSTANDARD
Definition
solver.h:23
TxoutType::MULTISIG
@ MULTISIG
Definition
solver.h:29
TxoutType::WITNESS_V0_KEYHASH
@ WITNESS_V0_KEYHASH
Definition
solver.h:32
TxoutType::PUBKEY
@ PUBKEY
Definition
solver.h:26
MatchMultiA
std::optional< std::pair< int, std::vector< std::span< const unsigned char > > > > MatchMultiA(const CScript &script LIFETIMEBOUND)
Determine if script is a "multi_a" script.
span.h
ByteUnit::t
@ t
Definition
strencodings.h:52
Generated on
for Bitcoin Core by
1.17.0