mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-03 17:54:19 +02:00
test: Move P2WSH_OP_TRUE to shared test library
This commit is contained in:
21
src/test/util/script.h
Normal file
21
src/test/util/script.h
Normal file
@@ -0,0 +1,21 @@
|
||||
// Copyright (c) 2021 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#ifndef BITCOIN_TEST_UTIL_SCRIPT_H
|
||||
#define BITCOIN_TEST_UTIL_SCRIPT_H
|
||||
|
||||
#include <crypto/sha256.h>
|
||||
#include <script/script.h>
|
||||
|
||||
static const std::vector<uint8_t> WITNESS_STACK_ELEM_OP_TRUE{uint8_t{OP_TRUE}};
|
||||
static const CScript P2WSH_OP_TRUE{
|
||||
CScript{}
|
||||
<< OP_0
|
||||
<< ToByteVector([] {
|
||||
uint256 hash;
|
||||
CSHA256().Write(WITNESS_STACK_ELEM_OP_TRUE.data(), WITNESS_STACK_ELEM_OP_TRUE.size()).Finalize(hash.begin());
|
||||
return hash;
|
||||
}())};
|
||||
|
||||
#endif // BITCOIN_TEST_UTIL_SCRIPT_H
|
||||
Reference in New Issue
Block a user