Commit graph

26 commits

Author SHA1 Message Date
Dave Collins
5c52f67b4f Update btcwire import paths to new location. 2015-01-16 15:18:22 -06:00
Dave Collins
c0c3d860d6 Convert all StackErrX to ErrStackX.
This commit changes all stack errors from the form of StackErrX to
ErrStackX which is the expected form for standard Go code.
2014-10-12 17:24:00 -05:00
Jonathan Gillham
edb006c11c Changed TxIn.PreviousOutpoint to TxIn.PreviousOutPoint after btcwire API change. 2014-10-01 13:57:27 +01:00
David Hill
2803ea17c2 Remove the use of go-spew. 2014-08-29 16:06:17 -04:00
Dave Collins
5beafbd2d8 goimports -w . 2014-07-02 19:37:49 -05:00
Owain G. Ainsworth
f80c3255a3 PopInt now guarantees that number will be 32 bit.
So remove later checks that need this.
2014-03-14 21:05:29 +00:00
David Hill
971fbf8b28 gofmt 2014-02-04 16:18:37 -05:00
Dave Collins
565f11409c Add 2014 to copyright dates. 2014-01-08 23:47:47 -06:00
Dave Collins
126991b60b Make opcode disasm names match reference impl.
This commit modifies the names of opcdoes shown in the oneline script
disassembly to match the reference implementation.  In particular
OP_1NEGATE, and OP_0 through OP_16 are changed to the raw numbers
they represent when doing oneline disassembly.  When doing full
disassembly, the full opcode names are still shown.

ok @owainga.
2014-01-07 12:07:54 -06:00
Dave Collins
2005fae908 Change OP_CHECK_MULTISIG -> OP_CHECKMULTISIG.
This change was made to match the reference implementation.
2014-01-04 15:23:51 -06:00
Dave Collins
c0c167cc15 Remove logging bits from script_test.go.
The allows the tests to run without showing warning for malformed bits
(which are intentionally malformed for testing purposes).  Also, the
tests would not compile since the new btclog backend was switched out.
This commit resolves that.
2013-12-10 18:31:21 -06:00
David Hill
8eead5217d Add flag bitmask to NewScript for canonical sig checks.
This removes the bip16 bool from NewScript and adds it to flags (with
the constant ScriptBip16), and also adds a new flag,
ScriptCanonicalSignatures, which will call btcec.ParseDERSignature
parsing a signature during an Execute.  This is needed to emulate
bitcoind behavior, as bitcoind performs canonical signature validation
(DER format) in some places (like mempool acceptance) but not others
(like block validation).

Updated tests and test coverage file to reflect changes.
2013-10-25 15:15:00 -04:00
Owain G. Ainsworth
52a1488eaf bitcoind only fails on invalid (undefined) opcodes when they are executed.
So add entries for them that disassemble and parse ok, but will fail
when executed with the appropriate error. Add a full suite of tests to confirm
that this happens.

Found by a strange transaction in testnet.
2013-10-08 00:16:23 +01:00
Owain G. Ainsworth
17d37e3b06 Fix up some ErrorF strings in tests.
One was missing a format directive. the others changed for consistency.
Appeases go vet.
2013-08-06 18:00:05 +01:00
Dave Collins
26fb20e4ed Remove need for protocol version.
This commit modifies the code to no longer require a protocol version.  It
does this by making use of the new Serialize function in btcwire.

Unfortuantely this does entail a public API change which I generally don't
like to do, but eliminating the usage of the protocol version throughout
the codebase was important enough to warrant the change.
2013-08-05 18:11:34 -05:00
Owain G. Ainsworth
22c29c4316 Perform pushed length checks at exec time, not parse.
To match bitcoind behaviour. Fix tests to agree with this direction.
2013-07-29 22:00:57 +01:00
Owain G. Ainsworth
e7f9415e4f Return 0 for bad scripts from sigops code instead of an error.
matches how bitcoind behaves.
2013-07-25 14:27:58 +01:00
Owain G. Ainsworth
89578c985a add basic test for OP_SHA1
yup, it produces the sha of the data.
2013-06-27 16:15:32 +01:00
Owain G. Ainsworth
e5a2756795 Test empty scripts and out of bounds for DisasmScript()
give disasmscript a defined error return for out of bounds.
2013-06-27 15:07:37 +01:00
Owain G. Ainsworth
bcd8c9d227 gofmt 2013-06-27 14:20:08 +01:00
Owain G. Ainsworth
dd216cef29 Test pushing at and beyond the boundary for largest stack item. 2013-06-26 23:57:49 +01:00
Owain G. Ainsworth
53ba8fb834 gofmt 2013-06-21 01:33:56 +01:00
Owain G. Ainsworth
03696a8874 Add functions to count the number of signature operations in a script.
To be usd for validation. Most of the codepaths teste, a few tests
missing for cases needed tests in the validation codepaths too. To be
worked on in tree.
2013-06-20 20:10:30 +01:00
Owain G. Ainsworth
25624bc6a7 check that OP_CHECK_MULTISIG also triggers on too many ops 2013-06-20 01:21:12 +01:00
Owain G. Ainsworth
bac455cdd2 Fix reversed test bug with the max operations handling
We were counting the number of push ops instead of the number of non
push ops.  Add tests that found this (checking tha the max operations
check fires).
2013-06-20 00:30:34 +01:00
Dave Collins
1197770159 Initial implementation. 2013-06-13 14:59:46 -05:00