txscript: Make error strings idiomatic.

This commit is contained in:
Jonathan Gillham 2015-08-09 14:06:36 +01:00
parent 3331d6098b
commit 27f7f82355

View File

@ -28,11 +28,11 @@ var (
// ErrStackOpDisabled is returned when a disabled opcode is encountered // ErrStackOpDisabled is returned when a disabled opcode is encountered
// in the script. // in the script.
ErrStackOpDisabled = errors.New("Disabled Opcode") ErrStackOpDisabled = errors.New("disabled opcode")
// ErrStackVerifyFailed is returned when one of the OP_VERIFY or // ErrStackVerifyFailed is returned when one of the OP_VERIFY or
// OP_*VERIFY instructions is executed and the conditions fails. // OP_*VERIFY instructions is executed and the conditions fails.
ErrStackVerifyFailed = errors.New("Verify failed") ErrStackVerifyFailed = errors.New("verify failed")
// ErrStackNumberTooBig is returned when the argument for an opcode that // ErrStackNumberTooBig is returned when the argument for an opcode that
// should be an offset is obviously far too large. // should be an offset is obviously far too large.
@ -40,15 +40,15 @@ var (
// ErrStackInvalidOpcode is returned when an opcode marked as invalid or // ErrStackInvalidOpcode is returned when an opcode marked as invalid or
// a completely undefined opcode is encountered. // a completely undefined opcode is encountered.
ErrStackInvalidOpcode = errors.New("Invalid Opcode") ErrStackInvalidOpcode = errors.New("invalid opcode")
// ErrStackReservedOpcode is returned when an opcode marked as reserved // ErrStackReservedOpcode is returned when an opcode marked as reserved
// is encountered. // is encountered.
ErrStackReservedOpcode = errors.New("Reserved Opcode") ErrStackReservedOpcode = errors.New("reserved opcode")
// ErrStackEarlyReturn is returned when OP_RETURN is executed in the // ErrStackEarlyReturn is returned when OP_RETURN is executed in the
// script. // script.
ErrStackEarlyReturn = errors.New("Script returned early") ErrStackEarlyReturn = errors.New("script returned early")
// ErrStackNoIf is returned if an OP_ELSE or OP_ENDIF is encountered // ErrStackNoIf is returned if an OP_ELSE or OP_ENDIF is encountered
// without first having an OP_IF or OP_NOTIF in the script. // without first having an OP_IF or OP_NOTIF in the script.
@ -60,15 +60,15 @@ var (
// ErrStackTooManyPubKeys is returned if an OP_CHECKMULTISIG is // ErrStackTooManyPubKeys is returned if an OP_CHECKMULTISIG is
// encountered with more than MaxPubKeysPerMultiSig pubkeys present. // encountered with more than MaxPubKeysPerMultiSig pubkeys present.
ErrStackTooManyPubKeys = errors.New("Invalid pubkey count in OP_CHECKMULTISIG") ErrStackTooManyPubKeys = errors.New("invalid pubkey count in OP_CHECKMULTISIG")
// ErrStackTooManyOperations is returned if a script has more than // ErrStackTooManyOperations is returned if a script has more than
// MaxOpsPerScript opcodes that do not push data. // MaxOpsPerScript opcodes that do not push data.
ErrStackTooManyOperations = errors.New("Too many operations in script") ErrStackTooManyOperations = errors.New("too many operations in script")
// ErrStackElementTooBig is returned if the size of an element to be // ErrStackElementTooBig is returned if the size of an element to be
// pushed to the stack is over MaxScriptElementSize. // pushed to the stack is over MaxScriptElementSize.
ErrStackElementTooBig = errors.New("Element in script too large") ErrStackElementTooBig = errors.New("element in script too large")
// ErrStackUnknownAddress is returned when ScriptToAddrHash does not // ErrStackUnknownAddress is returned when ScriptToAddrHash does not
// recognise the pattern of the script and thus can not find the address // recognise the pattern of the script and thus can not find the address
@ -82,12 +82,12 @@ var (
// ErrStackScriptUnfinished is returned when CheckErrorCondition is // ErrStackScriptUnfinished is returned when CheckErrorCondition is
// called on a script that has not finished executing. // called on a script that has not finished executing.
ErrStackScriptUnfinished = errors.New("Error check when script unfinished") ErrStackScriptUnfinished = errors.New("error check when script unfinished")
// ErrStackEmptyStack is returned when the stack is empty at the end of // ErrStackEmptyStack is returned when the stack is empty at the end of
// execution. Normal operation requires that a boolean is on top of the // execution. Normal operation requires that a boolean is on top of the
// stack when the scripts have finished executing. // stack when the scripts have finished executing.
ErrStackEmptyStack = errors.New("Stack empty at end of execution") ErrStackEmptyStack = errors.New("stack empty at end of execution")
// ErrStackP2SHNonPushOnly is returned when a Pay-to-Script-Hash // ErrStackP2SHNonPushOnly is returned when a Pay-to-Script-Hash
// transaction is encountered and the ScriptSig does operations other // transaction is encountered and the ScriptSig does operations other
@ -105,7 +105,7 @@ var (
// ErrStackInvalidIndex is returned when an out-of-bounds index was // ErrStackInvalidIndex is returned when an out-of-bounds index was
// passed to a function. // passed to a function.
ErrStackInvalidIndex = errors.New("Invalid script index") ErrStackInvalidIndex = errors.New("invalid script index")
// ErrStackNonPushOnly is returned when ScriptInfo is called with a // ErrStackNonPushOnly is returned when ScriptInfo is called with a
// pkScript that peforms operations other that pushing data to the stack. // pkScript that peforms operations other that pushing data to the stack.
@ -113,7 +113,7 @@ var (
// ErrStackOverflow is returned when stack and altstack combined depth // ErrStackOverflow is returned when stack and altstack combined depth
// is over the limit. // is over the limit.
ErrStackOverflow = errors.New("Stacks overflowed") ErrStackOverflow = errors.New("stack overflow")
// ErrStackInvalidLowSSignature is returned when the ScriptVerifyLowS // ErrStackInvalidLowSSignature is returned when the ScriptVerifyLowS
// flag is set and the script contains any signatures whose S values // flag is set and the script contains any signatures whose S values