mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-19 23:03:45 +01:00
Merge #12167: Make segwit failure due to CLEANSTACK violation return a SCRIPT_ERR_CLEANSTACK error code
1e747e3c1e Make segwit failure due to CLEANSTACK violation return a SCRIPT_ERR_CLEANSTACK error code. (Mark Friedenbach)
Pull request description:
If a segwit script terminates with a stack size not equal to one, the current error code is EVAL_FALSE. This is semantically wrong, and prevents explicitly checking CLEANSTACK violations in the unit tests. This PR changes the error code (and affected unit tests) to use SCRIPT_ERROR_CLEANSTACK instead of SCRIPT_ERROR_EVAL_FALSE.
Tree-SHA512: 8f7b1650f7a23a942cde1070e3e56420be456b4a7be42515b237e95557bf2bd5e7ba9aabd213c8092bea28c165dbe73f5a3486300089aeb01e698151b42484b1
This commit is contained in:
@@ -1402,7 +1402,7 @@ static bool VerifyWitnessProgram(const CScriptWitness& witness, int witversion,
|
||||
|
||||
// Scripts inside witness implicitly require cleanstack behaviour
|
||||
if (stack.size() != 1)
|
||||
return set_error(serror, SCRIPT_ERR_EVAL_FALSE);
|
||||
return set_error(serror, SCRIPT_ERR_CLEANSTACK);
|
||||
if (!CastToBool(stack.back()))
|
||||
return set_error(serror, SCRIPT_ERR_EVAL_FALSE);
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user