diff options
author | Johnson Lau <jl2012@xbt.hk> | 2020-09-11 14:34:02 -0700 |
---|---|---|
committer | Pieter Wuille <pieter@wuille.net> | 2020-10-12 17:18:24 -0700 |
commit | 72422ce396b8eba7b1a72c171c2f07dae691d1b5 (patch) | |
tree | d2aa2a75ed54579ed6ddac8f858cf3ca67605b48 /src/script/script.cpp | |
parent | 330de894a9a48515d9a473448b6c67adc3d188be (diff) | |
download | bitcoin-72422ce396b8eba7b1a72c171c2f07dae691d1b5.tar.xz |
Implement Tapscript script validation rules (BIP 342)
This adds a new `SigVersion::TAPSCRIPT`, makes the necessary interpreter
changes to make it implement BIP342, and uses them for leaf version 0xc0
in Taproot script path spends.
Diffstat (limited to 'src/script/script.cpp')
-rw-r--r-- | src/script/script.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/script/script.cpp b/src/script/script.cpp index 92c6fe7785..f31472e42d 100644 --- a/src/script/script.cpp +++ b/src/script/script.cpp @@ -140,6 +140,9 @@ std::string GetOpName(opcodetype opcode) case OP_NOP9 : return "OP_NOP9"; case OP_NOP10 : return "OP_NOP10"; + // Opcode added by BIP 342 (Tapscript) + case OP_CHECKSIGADD : return "OP_CHECKSIGADD"; + case OP_INVALIDOPCODE : return "OP_INVALIDOPCODE"; default: @@ -328,3 +331,11 @@ bool GetScriptOp(CScriptBase::const_iterator& pc, CScriptBase::const_iterator en opcodeRet = static_cast<opcodetype>(opcode); return true; } + +bool IsOpSuccess(const opcodetype& opcode) +{ + return opcode == 80 || opcode == 98 || (opcode >= 126 && opcode <= 129) || + (opcode >= 131 && opcode <= 134) || (opcode >= 137 && opcode <= 138) || + (opcode >= 141 && opcode <= 142) || (opcode >= 149 && opcode <= 153) || + (opcode >= 187 && opcode <= 254); +} |