Bitcoin Core
31.1.0
P2P Digital Currency
Toggle main menu visibility
Loading...
Searching...
No Matches
src
test
util
script.h
Go to the documentation of this file.
1
// Copyright (c) 2021-present The Bitcoin Core developers
2
// Distributed under the MIT software license, see the accompanying
3
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
5
#ifndef BITCOIN_TEST_UTIL_SCRIPT_H
6
#define BITCOIN_TEST_UTIL_SCRIPT_H
7
8
#include <
crypto/sha256.h
>
9
#include <
script/script.h
>
10
#include <
script/verify_flags.h
>
11
12
static
const
std::vector<uint8_t>
WITNESS_STACK_ELEM_OP_TRUE
{uint8_t{
OP_TRUE
}};
13
static
const
CScript
P2WSH_OP_TRUE
{
14
CScript
{}
15
<<
OP_0
16
<<
ToByteVector
([] {
17
uint256
hash;
18
CSHA256
().
Write
(
WITNESS_STACK_ELEM_OP_TRUE
.data(),
WITNESS_STACK_ELEM_OP_TRUE
.size()).
Finalize
(hash.
begin
());
19
return
hash;
20
}())};
21
22
static
const
std::vector<uint8_t>
EMPTY
{};
23
static
const
CScript
P2WSH_EMPTY
{
24
CScript
{}
25
<<
OP_0
26
<<
ToByteVector
([] {
27
uint256
hash;
28
CSHA256
().
Write
(
EMPTY
.data(),
EMPTY
.size()).
Finalize
(hash.
begin
());
29
return
hash;
30
}())};
31
static
const
std::vector<std::vector<uint8_t>>
P2WSH_EMPTY_TRUE_STACK
{{
static_cast<
uint8_t
>
(
OP_TRUE
)}, {}};
32
static
const
std::vector<std::vector<uint8_t>>
P2WSH_EMPTY_TWO_STACK
{{
static_cast<
uint8_t
>
(
OP_2
)}, {}};
33
35
bool
IsValidFlagCombination
(
script_verify_flags
flags
);
36
37
#endif
// BITCOIN_TEST_UTIL_SCRIPT_H
flags
int flags
Definition
bitcoin-tx.cpp:529
CSHA256
A hasher class for SHA-256.
Definition
sha256.h:14
CSHA256::Finalize
void Finalize(unsigned char hash[OUTPUT_SIZE])
Definition
sha256.cpp:725
CSHA256::Write
CSHA256 & Write(const unsigned char *data, size_t len)
Definition
sha256.cpp:699
CScript
Serialized script, used inside transaction inputs and outputs.
Definition
script.h:405
base_blob::begin
constexpr unsigned char * begin()
Definition
uint256.h:100
script_verify_flags
Definition
verify_flags.h:15
uint256
256-bit opaque blob.
Definition
uint256.h:195
script.h
OP_2
@ OP_2
Definition
script.h:85
OP_TRUE
@ OP_TRUE
Definition
script.h:84
OP_0
@ OP_0
Definition
script.h:76
ToByteVector
std::vector< unsigned char > ToByteVector(const T &in)
Definition
script.h:67
sha256.h
P2WSH_EMPTY_TRUE_STACK
static const std::vector< std::vector< uint8_t > > P2WSH_EMPTY_TRUE_STACK
Definition
script.h:31
IsValidFlagCombination
bool IsValidFlagCombination(script_verify_flags flags)
Flags that are not forbidden by an assert in script validation.
Definition
script.cpp:8
P2WSH_EMPTY_TWO_STACK
static const std::vector< std::vector< uint8_t > > P2WSH_EMPTY_TWO_STACK
Definition
script.h:32
WITNESS_STACK_ELEM_OP_TRUE
static const std::vector< uint8_t > WITNESS_STACK_ELEM_OP_TRUE
Definition
script.h:12
EMPTY
static const std::vector< uint8_t > EMPTY
Definition
script.h:22
P2WSH_OP_TRUE
static const CScript P2WSH_OP_TRUE
Definition
script.h:13
P2WSH_EMPTY
static const CScript P2WSH_EMPTY
Definition
script.h:23
verify_flags.h
Generated on
for Bitcoin Core by
1.17.0