diff options
author | MarcoFalke <falke.marco@gmail.com> | 2021-01-15 15:50:15 +0100 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2021-02-17 11:36:30 +0100 |
commit | 22220ef6d5f331c9e1f3e9487eaf07ab13693921 (patch) | |
tree | cdc3d22ac34e70610619f61fc1a117461400dc80 /src/test/util/script.h | |
parent | 569b5ba1dc56ef1df2fc7dbf22b5fdbf35c87556 (diff) | |
download | bitcoin-22220ef6d5f331c9e1f3e9487eaf07ab13693921.tar.xz |
test: Move P2WSH_OP_TRUE to shared test library
Diffstat (limited to 'src/test/util/script.h')
-rw-r--r-- | src/test/util/script.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/test/util/script.h b/src/test/util/script.h new file mode 100644 index 0000000000..abd14c2067 --- /dev/null +++ b/src/test/util/script.h @@ -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 |