Commit graph

32 commits

Author SHA1 Message Date
Peter Todd aa41ac216e
Test IsPushOnly() with invalid push 2014-08-24 21:16:51 -04:00
jtimon f5745fa52a Declare SignatureHash() in script.h 2014-08-01 17:45:09 +02:00
Jeff Garzik b2aeaa7939 Move ParseScript() helper, becoming accessible outside src/test/ 2014-07-29 11:13:27 -04:00
Pieter Wuille 4949004d68 Add CMutableTransaction and make CTransaction immutable.
In addition, introduce a cached hash inside CTransaction, to prevent
recalculating it over and over again.
2014-06-21 22:59:03 +02:00
Gavin Andresen aaab675a78 Merge pull request #3860 from petertodd/test-checkmulti-n-m-zero
Test CHECKMULTISIG with m == 0 and/or n == 0
2014-05-09 10:00:16 -04:00
Wladimir J. van der Laan 3fc6846181 Add licenses for tests and test data
- Add license headers to source files (years based on commit dates)
  in `src/test` as well as `qa`
- Add `README.md` to `src/test/data` specifying MIT license

Fixes #3848
2014-03-18 10:20:55 +01:00
Peter Todd b41e594773
Fix script test handling of empty scripts
Previously an empty script would evaluate to OP_0
2014-03-12 20:14:01 -04:00
Pieter Wuille 87fe71e1fc Add HasCanonicalPushes(), and use it in IsStandardTx 2014-02-11 21:11:59 +01:00
Brandon Dahler 51ed9ec971 Cleanup code using forward declarations.
Use misc methods of avoiding unnecesary header includes.
Replace int typedefs with int##_t from stdint.h.
Replace PRI64[xdu] with PRI[xdu]64 from inttypes.h.
Normalize QT_VERSION ifs where possible.
Resolve some indirect dependencies as direct ones.
Remove extern declarations from .cpp files.
2013-11-10 09:36:28 -06:00
Jeff Garzik 0db9a805bd Revert "Switch to using raw_utf8"
This reverts commit 2ecb7555a9.
2013-10-22 05:43:38 -04:00
Gavin Andresen 125bdead3e Merge pull request #2740 from constantined/constantined
UTF-8 support for JSON-RPC
2013-10-22 01:20:02 -07:00
Pieter Wuille f5857e5cb5 Inline signature serializer
Instead of building a full copy of a CTransaction being signed, and
then modifying bits and pieces until its fits the form necessary
for computing the signature hash, use a wrapper serializer that
only serializes the necessary bits on-the-fly.

This makes it easier to see which data is actually being hash,
reduces load on the heap, and also marginally improves performances
(around 3-4us/sigcheck here). The performance improvements are much
larger for large transactions, though.

The old implementation of SignatureHash is moved to a unit tests,
to test whether the old and new algorithm result in the same value
for randomly-constructed transactions.
2013-09-28 18:37:00 +02:00
Cory Fields 152e51c7af included-tests: generate binary data from test files for inclusion into test binaries
This change moves test data into the binaries rather than reading them from
the disk at runtime.

Advantages:
- Tests become distributable
- Cross-compile friendly. Build on one machine and execute in an arbitrary
  location on another.
- Easier testing for backports. Users can verify that tests pass without having
  to track down corresponding test data.
- More trustworthy test results and easier quality assurance as tests make
  fewer assumptions about their environment.
- Tests could theoretically run at client/daemon startup and exit on failure.

Disadvantages:
- Required 'hexdump' build-dependency. This is a standard bsd tool that should
  be usable everywhere. It is likely already installed on all build-machines.
- Tests can no longer be fudged after build by altering test-data.
2013-09-16 12:53:11 -04:00
Luke Dashjr 1e9d3b1392 Bugfix: Since test_bitcoin is being built and run inside src/test/, try using relative directories from that point 2013-09-10 23:04:56 +00:00
Peter Todd 214d45b6b9
Document and test OP_RESERVED weirdness
Seems it was forgotten about when IsPushOnly() and the unittests were
written. A particular oddity is that OP_RESERVED doesn't count towards
the >201 opcode limit unlike every other named opcode.
2013-08-25 12:37:07 -04:00
constantined 2ecb7555a9 Switch to using raw_utf8 2013-07-23 04:51:29 +03:00
Pieter Wuille dfa23b94c2 CSecret/CKey -> CKey/CPubKey split/refactor 2013-05-30 05:20:21 +02:00
Pieter Wuille 99d0d0f356 Introduce script verification flags
These flags select features to be enabled/disabled during script
evaluation/checking, instead of several booleans passed along.
Currently these flags are defined:
* SCRIPT_VERIFY_P2SH: enable BIP16-style subscript evaluation
* SCRIPT_VERIFY_STRICTENC: enforce strict adherence to pubkey/sig encoding standards.
2012-11-15 23:00:16 +01:00
Philip Kaufmann 729b180686 change blockchain -> block chain (spelling)
- Wiki says "block chain" is correct ;)
- remove some unneeded spaces I found in the source, while fixing the spelling
2012-10-21 21:32:25 +02:00
Pieter Wuille 58bc86e37f Check for canonical public keys and signatures
Only enabled inside tests for now.
2012-09-21 01:24:25 +02:00
Gavin Andresen a2709fad7f Implement raw transaction RPC calls
Implement listunspent / getrawtransaction / createrawtransaction /
signrawtransaction, to support creation and
signing-on-multiple-device multisignature transactions.
2012-07-05 12:50:09 -04:00
Gavin Andresen 6b8a17119e Lots more Script unit test cases. 2012-05-24 17:32:09 -04:00
Gavin Andresen f04017f702 More CScript unit tests. 2012-05-24 13:29:08 -04:00
Gavin Andresen 9e71a5cd23 Define TEST_DATA_DIR so unit tests can be run from any current working directory 2012-04-26 11:20:44 -04:00
Gavin Andresen 8449a8788a Data-drive script evaluation unit tests. 2012-04-21 19:35:39 -04:00
Pieter Wuille 0d56f11ada Fix tests after 38067c18 2012-02-20 18:32:33 +01:00
Gavin Andresen 922e8e2929 Replace OP_EVAL (BIP 12) with Pay-to-script-hash (BIP 16). 2012-01-13 10:22:23 -05:00
Gavin Andresen 2a45a494b0 Use block times for 'hard' OP_EVAL switchover, and refactored EvalScript
so it takes a flag for how to interpret OP_EVAL.
Also increased IsStandard size of scriptSigs to 500 bytes, so
a 3-of-3 multisig transaction IsStandard.
2011-12-19 13:24:48 -05:00
Gavin Andresen e679ec969c OP_EVAL implementation
OP_EVAL is a new opcode that evaluates an item on the stack as a script.
It enables a new type of bitcoin address that needs an arbitrarily
complex script to redeem.
2011-12-19 12:40:19 -05:00
Gavin Andresen 1466b8b78a Rework unit tests so test_bitcoin.cpp does not #include them all 2011-12-19 12:39:47 -05:00
Gavin Andresen 829e21733b CHECKMULTISIG unit tests. 2011-08-26 18:43:58 -04:00
Vegard Nossum a8330e0049 Add a file for script tests 2011-08-08 14:31:08 -04:00