Coverage Report

Created: 2026-08-25 19:02

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/root/bitcoin/src/test/util/script.h
Line
Count
Source
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
inline const std::vector<uint8_t> WITNESS_STACK_ELEM_OP_TRUE{uint8_t{OP_TRUE}};
13
inline const CScript P2WSH_OP_TRUE{
14
    CScript{}
15
    << OP_0
16
0
    << ToByteVector([] {
17
0
           uint256 hash;
18
0
           CSHA256().Write(WITNESS_STACK_ELEM_OP_TRUE.data(), WITNESS_STACK_ELEM_OP_TRUE.size()).Finalize(hash.begin());
19
0
           return hash;
20
0
       }())};
21
22
inline const std::vector<uint8_t> EMPTY{};
23
inline const CScript P2WSH_EMPTY{
24
    CScript{}
25
    << OP_0
26
0
    << ToByteVector([] {
27
0
           uint256 hash;
28
0
           CSHA256().Write(EMPTY.data(), EMPTY.size()).Finalize(hash.begin());
29
0
           return hash;
30
0
       }())};
31
inline const std::vector<std::vector<uint8_t>> P2WSH_EMPTY_TRUE_STACK{{static_cast<uint8_t>(OP_TRUE)}, {}};
32
inline const std::vector<std::vector<uint8_t>> P2WSH_EMPTY_TWO_STACK{{static_cast<uint8_t>(OP_2)}, {}};
33
34
/** Flags that are not forbidden by an assert in script validation */
35
bool IsValidFlagCombination(script_verify_flags flags);
36
37
#endif // BITCOIN_TEST_UTIL_SCRIPT_H