diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -308,6 +308,7 @@ primitives/transaction.cpp pubkey.cpp script/bitcoinconsensus.cpp + script/bitfield.cpp script/interpreter.cpp script/script.cpp script/script_error.cpp diff --git a/src/Makefile.am b/src/Makefile.am --- a/src/Makefile.am +++ b/src/Makefile.am @@ -389,6 +389,8 @@ pubkey.cpp \ pubkey.h \ script/bitcoinconsensus.cpp \ + script/bitfield.cpp \ + script/bitfield.h \ script/sighashtype.h \ script/interpreter.cpp \ script/interpreter.h \ diff --git a/src/Makefile.test.include b/src/Makefile.test.include --- a/src/Makefile.test.include +++ b/src/Makefile.test.include @@ -101,6 +101,7 @@ test/scheduler_tests.cpp \ test/schnorr_tests.cpp \ test/script_commitment_tests.cpp \ + test/script_bitfield_tests.cpp \ test/script_p2sh_tests.cpp \ test/script_standard_tests.cpp \ test/script_tests.cpp \ diff --git a/src/script/bitfield.h b/src/script/bitfield.h new file mode 100644 --- /dev/null +++ b/src/script/bitfield.h @@ -0,0 +1,16 @@ +// Copyright (c) 2019 The Bitcoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#ifndef BITCOIN_SCRIPT_BITFIELD_H +#define BITCOIN_SCRIPT_BITFIELD_H + +#include +#include + +enum class ScriptError; + +bool DecodeBitfield(const std::vector &vch, unsigned size, + uint32_t &bitfield, ScriptError *serror); + +#endif // BITCOIN_SCRIPT_BITFIELD_H diff --git a/src/script/bitfield.cpp b/src/script/bitfield.cpp new file mode 100644 --- /dev/null +++ b/src/script/bitfield.cpp @@ -0,0 +1,35 @@ +// Copyright (c) 2019 The Bitcoin developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#include