mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-20 15:19:07 +01:00
script/interpreter: introduce script_verify_flags typename
Previously the SCRIPT_VERIFY_* flags were specified as either uint32_t, unsigned int, or unsigned. This converts them to a common type alias in preparation for changing the underlying type.
This commit is contained in:
@@ -40,9 +40,9 @@
|
||||
|
||||
using namespace util::hex_literals;
|
||||
|
||||
static const unsigned int gFlags = SCRIPT_VERIFY_P2SH | SCRIPT_VERIFY_STRICTENC;
|
||||
static const script_verify_flags gFlags = SCRIPT_VERIFY_P2SH | SCRIPT_VERIFY_STRICTENC;
|
||||
|
||||
unsigned int ParseScriptFlags(std::string strFlags);
|
||||
script_verify_flags ParseScriptFlags(std::string strFlags);
|
||||
|
||||
struct ScriptErrorDesc
|
||||
{
|
||||
@@ -120,7 +120,7 @@ static ScriptError_t ParseScriptError(const std::string& name)
|
||||
}
|
||||
|
||||
struct ScriptTest : BasicTestingSetup {
|
||||
void DoTest(const CScript& scriptPubKey, const CScript& scriptSig, const CScriptWitness& scriptWitness, uint32_t flags, const std::string& message, int scriptError, CAmount nValue = 0)
|
||||
void DoTest(const CScript& scriptPubKey, const CScript& scriptSig, const CScriptWitness& scriptWitness, script_verify_flags flags, const std::string& message, int scriptError, CAmount nValue = 0)
|
||||
{
|
||||
bool expect = (scriptError == SCRIPT_ERR_OK);
|
||||
if (flags & SCRIPT_VERIFY_CLEANSTACK) {
|
||||
@@ -232,7 +232,7 @@ private:
|
||||
bool havePush{false};
|
||||
std::vector<unsigned char> push;
|
||||
std::string comment;
|
||||
uint32_t flags;
|
||||
script_verify_flags flags;
|
||||
int scriptError{SCRIPT_ERR_OK};
|
||||
CAmount nValue;
|
||||
|
||||
@@ -252,7 +252,7 @@ private:
|
||||
}
|
||||
|
||||
public:
|
||||
TestBuilder(const CScript& script_, const std::string& comment_, uint32_t flags_, bool P2SH = false, WitnessMode wm = WitnessMode::NONE, int witnessversion = 0, CAmount nValue_ = 0) : script(script_), comment(comment_), flags(flags_), nValue(nValue_)
|
||||
TestBuilder(const CScript& script_, const std::string& comment_, script_verify_flags flags_, bool P2SH = false, WitnessMode wm = WitnessMode::NONE, int witnessversion = 0, CAmount nValue_ = 0) : script(script_), comment(comment_), flags(flags_), nValue(nValue_)
|
||||
{
|
||||
CScript scriptPubKey = script;
|
||||
if (wm == WitnessMode::PKH) {
|
||||
@@ -969,7 +969,7 @@ BOOST_AUTO_TEST_CASE(script_json_test)
|
||||
} else {
|
||||
scriptPubKey = ParseScript(scriptPubKeyString);
|
||||
}
|
||||
unsigned int scriptflags = ParseScriptFlags(test[pos++].get_str());
|
||||
script_verify_flags scriptflags = ParseScriptFlags(test[pos++].get_str());
|
||||
int scriptError = ParseScriptError(test[pos++].get_str());
|
||||
|
||||
DoTest(scriptPubKey, scriptSig, witness, scriptflags, strTest, scriptError, nValue);
|
||||
|
||||
Reference in New Issue
Block a user