Commit graph

8 commits

Author SHA1 Message Date
Dave Collins fdc2bc867b
txscript: Significantly improve errors.
This converts the majority of script errors from generic errors created
via errors.New and fmt.Errorf to use a concrete type that implements the
error interface with an error code and description.

This allows callers to programmatically detect the type of error via
type assertions and an error code while still allowing the errors to
provide more context.

For example, instead of just having an error the reads "disabled opcode"
as would happen prior to these changes when a disabled opcode is
encountered, the error will now read "attempt to execute disabled opcode
OP_FOO".

While it was previously possible to programmatically detect many errors
due to them being exported, they provided no additional context and
there were also various instances that were just returning errors
created on the spot which callers could not reliably detect without
resorting to looking at the actual error message, which is nearly always
bad practice.

Also, while here, export the MaxStackSize and MaxScriptSize constants
since they can be useful for consumers of the package and perform some
minor cleanup of some of the tests.
2017-01-12 13:12:39 -06:00
Alex 9f962b60d6 Add version command to JSON-RPC API for API versioning 2016-12-22 14:48:53 -05:00
Waldir Pimenta fb9b640ef2 add license title (#717)
It's not strictly required, but it's useful metadata, and part of the recommended license template text (see http://choosealicense.com/licenses/isc/ and https://opensource.org/licenses/isc-license)
2016-08-11 16:58:15 -05:00
Jonathan Zeppettini 407fcc2aaf Update LICENSE 2016-01-23 16:06:10 -05:00
Dave Collins 6e402deb35 Relicense to the btcsuite developers.
This commit relicenses all code in this repository to the btcsuite
developers.
2015-05-01 12:00:56 -05:00
Ben Holden-Crowther 08257ac529 Updated license date
Changed 2014 to 2015 in preparation for new year
2014-12-29 20:46:11 +00:00
Dave Collins aeec39c1ff Add 2014 to copyright dates. 2014-01-01 10:16:15 -06:00
Dave Collins 3f54e4199f Initial import. 2013-08-06 19:17:05 -05:00