mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-15 12:51:00 +02:00
More meaningful error messages for WPV failure
This commit is contained in:
parent
eedc9606a5
commit
2ff3733d6b
3 changed files with 17 additions and 4 deletions
|
|
@ -1191,7 +1191,7 @@ bool EvalScript(vector<vector<unsigned char> >& stack, const CScript& script, un
|
|||
|
||||
CScriptID expectedP2SH(scriptDestination);
|
||||
if (locktx.vout[nlocktxOut].scriptPubKey != GetScriptForDestination(expectedP2SH))
|
||||
return set_error(serror, SCRIPT_ERR_WITHDRAW_VERIFY_OUTPUT);
|
||||
return set_error(serror, SCRIPT_ERR_WITHDRAW_VERIFY_OUTPUT_SCRIPTDEST);
|
||||
|
||||
vcontract.erase(vcontract.begin() + 4, vcontract.begin() + 20); // Remove the nonce from the contract before further processing
|
||||
assert(vcontract.size() == 24);
|
||||
|
|
@ -1210,14 +1210,14 @@ bool EvalScript(vector<vector<unsigned char> >& stack, const CScript& script, un
|
|||
if (!newLockOutput.nValue.IsAmount())
|
||||
return set_error(serror, SCRIPT_ERR_WITHDRAW_VERIFY_BLINDED_AMOUNTS);
|
||||
if (newLockOutput.IsNull() || newLockOutput.scriptPubKey != relockScript || newLockOutput.nValue.GetAmount() < lockValueRequired)
|
||||
return set_error(serror, SCRIPT_ERR_WITHDRAW_VERIFY_OUTPUT);
|
||||
return set_error(serror, SCRIPT_ERR_WITHDRAW_VERIFY_RELOCK_SCRIPTVAL);
|
||||
}
|
||||
|
||||
const CTxOut withdrawOutput = checker.GetOutputOffsetFromCurrent(0);
|
||||
if (!withdrawOutput.nValue.IsAmount())
|
||||
return set_error(serror, SCRIPT_ERR_WITHDRAW_VERIFY_BLINDED_AMOUNTS);
|
||||
if (withdrawOutput.nValue.GetAmount() < withdrawVal)
|
||||
return set_error(serror, SCRIPT_ERR_WITHDRAW_VERIFY_OUTPUT);
|
||||
return set_error(serror, SCRIPT_ERR_WITHDRAW_VERIFY_OUTPUT_VAL);
|
||||
|
||||
CScript expectedWithdrawScriptPubKey;
|
||||
if (vcontract[0] == 'P' && vcontract[1] == '2' && vcontract[2] == 'S' && vcontract[3] == 'H')
|
||||
|
|
@ -1228,7 +1228,7 @@ bool EvalScript(vector<vector<unsigned char> >& stack, const CScript& script, un
|
|||
return set_error(serror, SCRIPT_ERR_WITHDRAW_VERIFY_FORMAT);
|
||||
|
||||
if (withdrawOutput.scriptPubKey != expectedWithdrawScriptPubKey)
|
||||
return set_error(serror, SCRIPT_ERR_WITHDRAW_VERIFY_OUTPUT);
|
||||
return set_error(serror, SCRIPT_ERR_WITHDRAW_VERIFY_OUTPUT_SCRIPT);
|
||||
|
||||
#ifndef BITCOIN_SCRIPT_NO_CALLRPC
|
||||
if (GetBoolArg("-validatepegin", false) && !checker.IsConfirmedBitcoinBlock(genesishash, merkleBlock.header.GetHash(), flags & SCRIPT_VERIFY_INCREASE_CONFIRMATIONS_REQUIRED))
|
||||
|
|
|
|||
|
|
@ -99,6 +99,14 @@ const char* ScriptErrorString(const ScriptError serror)
|
|||
return "Withdraw proof validation failed - lock block was not sufficiently confirmed on sending chain";
|
||||
case SCRIPT_ERR_WITHDRAW_VERIFY_BLINDED_AMOUNTS:
|
||||
return "Withdraw proof validation failed - amounts in outputs were blinded";
|
||||
case SCRIPT_ERR_WITHDRAW_VERIFY_OUTPUT_SCRIPTDEST:
|
||||
return "Withdraw proof validation failed - Bitcoin output script destination does not match federation script";
|
||||
case SCRIPT_ERR_WITHDRAW_VERIFY_RELOCK_SCRIPTVAL:
|
||||
return "Withdraw proof validation failed - Relock scriptpubkey or value is invalid";
|
||||
case SCRIPT_ERR_WITHDRAW_VERIFY_OUTPUT_VAL:
|
||||
return "Withdraw proof validation failed - Withdraw output value invalid";
|
||||
case SCRIPT_ERR_WITHDRAW_VERIFY_OUTPUT_SCRIPT:
|
||||
return "Withdraw proof validation failed - Sidechain pegin destination does not match expected";
|
||||
case SCRIPT_ERR_UNKNOWN_ERROR:
|
||||
case SCRIPT_ERR_ERROR_COUNT:
|
||||
default: break;
|
||||
|
|
|
|||
|
|
@ -69,6 +69,11 @@ typedef enum ScriptError_t
|
|||
SCRIPT_ERR_WITHDRAW_VERIFY_BLOCK,
|
||||
SCRIPT_ERR_WITHDRAW_VERIFY_LOCKTX,
|
||||
SCRIPT_ERR_WITHDRAW_VERIFY_OUTPUT,
|
||||
SCRIPT_ERR_WITHDRAW_VERIFY_OUTPUT_SCRIPTDEST,
|
||||
SCRIPT_ERR_WITHDRAW_VERIFY_RELOCK_SCRIPTVAL,
|
||||
SCRIPT_ERR_WITHDRAW_VERIFY_OUTPUT_VAL,
|
||||
SCRIPT_ERR_WITHDRAW_VERIFY_OUTPUT_SCRIPT,
|
||||
|
||||
SCRIPT_ERR_WITHDRAW_VERIFY_BLOCKCONFIRMED,
|
||||
SCRIPT_ERR_WITHDRAW_VERIFY_BLINDED_AMOUNTS,
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue