Commit graph

166 commits

Author SHA1 Message Date
Dave Collins
f513a56a62 Update btcnet import paths to new location. 2015-01-16 17:29:53 -06:00
Dave Collins
5c52f67b4f Update btcwire import paths to new location. 2015-01-16 15:18:22 -06:00
Dave Collins
6efda349da Update btclog import paths to new location. 2015-01-16 11:18:14 -06:00
Dave Collins
6dcc6e5e66 Update fastsha256 import paths to new location. 2015-01-16 09:17:15 -06:00
Dave Collins
c112c004cf Update log test for upstream seelog changes. 2015-01-16 09:15:43 -06:00
Dave Collins
c4f1ed69d2 Update btcutil import paths to new location. 2015-01-15 10:42:26 -06:00
Dave Collins
8e1973d865 Correct a couple of typos spotted while reviewing. 2014-12-20 01:55:27 -06:00
Guilherme Salgado
2f902a5880 Rename signTxOutput to RawTxInSignature 2014-12-20 01:51:54 -06:00
David Hill
45e7fe103f Sync TX tests with Bitcoin Core. 2014-12-19 15:20:48 -05:00
Josh Rickmar
bca3d5ba7b Switch to new subrepo import paths. 2014-12-11 10:31:17 -05:00
David Hill
def35f2cd4 Sync Bitcoin Core tests. 2014-12-08 17:34:03 -05:00
Jonathan Gillham
a61c0f06cf Removed unnecessary signTxOutputCustomReader. 2014-10-13 13:47:44 +01:00
Jimmy Song
d5cc72dc27 use btcec structs instead of ecdsa structs 2014-10-12 23:47:09 -05:00
Dave Collins
ce0a334329 Comment ScriptInfo struct according to standards.
Found by golint.
2014-10-12 19:39:01 -05: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
37ad7042b6 Made hashType typed as SigHashType. 2014-10-11 20:55:28 +01:00
Jonathan Gillham
9f47e9369c Fixed SignTxOutput doc spelling error. 2014-10-10 20:17:20 -05:00
kac-
b89cabfb29 comment:script.go: ScriptDB->KeyDB 2014-10-05 10:19:29 +02: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
Jonathan Gillham
516db23576 Replaced privkey in entire codebase. 2014-08-25 21:14:19 +01:00
Jonathan Gillham
da080e1598 Changed privkey to privKey for consistency. 2014-08-25 21:09:23 +01:00
Dave Collins
95cd1b97fa Make the OP_FALSE constant untyped.
This makes it consistent with the rest of the opcode constants.
2014-08-13 00:32:16 -05:00
Michalis Kargakis
6ae916bd37 More tests
Tests for IsPushOnlyScript, HasCanonicalPushes, and CalcMultiSigStats
2014-08-08 14:53:55 +03:00
Michalis Kargakis
55ad967b4d Complete SetLogWriter testing 2014-08-03 23:30:37 +03:00
David Hill
ef0ca7dff5 sync bitcoind script tests 2014-08-01 13:40:56 -04:00
Michalis Kargakis
24c3873956 Add log testing
8/10 of SetLogWriter tested
2014-07-31 23:42:09 +03:00
Dave Collins
95167204d9 Add ExtractPkScriptAddrs examples. 2014-07-08 14:59:57 -05:00
Dave Collins
631c7850ec Correct example link in README.md. 2014-07-08 14:43:50 -05:00
Dave Collins
abafe9678b Use testable example and update doc.go README.md.
This commit adds an example test file so it integrates nicely with Go's
example tooling.

This allows the example output to be tested as a part of running the
normal Go tests to help ensure it doesn't get out of date with the code.
It is also nice to have the example in one place rather than repeating it
in doc.go and README.md.

Links and information about the example have been included in README.md in
place of the example.
2014-07-08 14:42:39 -05:00
Dave Collins
3c2ae358b4 Add godoc reference badge to README.md. 2014-07-08 14:13:08 -05:00
Dave Collins
5beafbd2d8 goimports -w . 2014-07-02 19:37:49 -05:00
Dave Collins
79b6e51dff Update tests for recent btcutil.Address API change. 2014-07-02 19:36:41 -05:00
David Hill
7d228846bd sync tx_valid.json test data. 2014-06-13 11:34:47 -04:00
David Hill
e560b6d964 sync bitcoind test data. 2014-05-29 10:56:43 -04:00
David Hill
a591c7ec03 Add new ScriptFlag ScriptStrictMultiSig.
ScriptStrictMultiSig verifies that the stack item used by CHECKMULTISIG
is zero length.
2014-05-29 10:55:35 -04:00
Josh Rickmar
be325b9d9c Update API for btcnet and btcutil changes.
ok @davecgh
2014-05-27 17:42:01 -05:00
David Hill
27e1ad758b Add new function PushedData.
PushedData returns an array of byte slices containing any pushed data
found in the passed script.  This includes OP_0, but not OP_1 - OP_16.

help from and ok @owainga
2014-05-20 12:24:23 -04:00
Owain G. Ainsworth
6e2ba386dd Add an entypoint to sign and verify a transaction input.
This handles merging in of previous scripts, also. Add tests for the important
paths. ok @davecgh
2014-05-07 16:05:55 +01:00
David Hill
76e8fa9766 Reduce OP_RETURN standard relay bytes to 40.
This matches commit 8175c790eb12f0b0ca3197895a6d1d479b340b67 of
the reference software.
2014-05-01 09:42:15 -04:00
David Hill
1240483592 gofmt 2014-04-11 14:54:44 -04:00
Owain G. Ainsworth
03dd134305 adapt for btcec changes. 2014-04-09 19:30:59 +01:00
Dave Collins
4fce6d1476 Sync latest script tests to bitcoind test suite. 2014-04-03 23:18:52 -05:00
Dave Collins
f529a37123 Add tests for doing math on 5-byte ints.
This commit addes a couple of tests to ensure performing math operations
on a 5-byte integer, even if the result is a 4-byte integer, is considered
invalid.
2014-04-03 17:13:44 -05:00
Owain G. Ainsworth
8ec60d4678 Quick and dirty tests harnesses using some bitcoind test data.
Both the script tests (positive and negative) and tx texts (ditto) are
present.  Some of the tx tests in the negative section have been
replaced by a comment line explaining why that test is elided, to add in
diffing. The reasons were always that they test things handled by other
parts of the btcd stack (normally chain). For example MAX_MONEY, number
of outputs, coinbase sizes etc.

Much of the inital test logic from @dajohi using hand transcribed tables
for selected tests. The json parsers, script format parser and a lot of
cleaning up/bugfixing from your truly. @davecgh had some input too.
2014-03-19 01:06:19 +00:00
Owain G. Ainsworth
5f6de02eb8 use bytes.Repeat instead of my perlscript generated lists of zeros.
Pointed out by davec. I'd forgotten about it. Kills just over 10k lines
from the test file.
2014-03-19 00:43:21 +00:00
Owain G. Ainsworth
1b1fef7369 Make removeOpcodeByData only search canonical pushes.
Matches bitcoind behaviour. Pointed out by one of their tx_invalid tests.
2014-03-18 18:28:09 +00:00
Owain G. Ainsworth
76339baf6c Make removeOpcodeByData in line with bitcoind behaviour.
It should remove the opcode and data is the data is contained within the data
pushed, not just if it is equal to it. Found by bitcoind tx tests.
2014-03-18 00:49:24 +00:00
Owain G. Ainsworth
dab2a7cb0f Don't possibly dereference bad signatures in OP_CHECKMULTISIG.
We do all the preprocessing in one loop. Fixes a bug introduced a while ago to
handle invalid signatures. Found by more tests from bitcoind.
2014-03-17 17:46:56 +00:00
Dave Collins
c8332cc9a7 Correct num expected inputs calc for multisig.
This commit corrects the number of expected inputs for a multi-sig script
to include the additional item that is popped from the stack due to the
OP_CHECKMULTISIG consensus bug (which is required and properly performed).

Note this issue did NOT affect the consensus critical code and hence would
not cause a chain fork.  It did however, cause standard p2sh multisig txns
to be rejected from the mempool as nonstandard.

The tx rejected as non-standard which prompted this was spotted by
@mbelshe on IRC.

ok @owainga
2014-03-17 10:47:02 -05:00