Commit graph

74 commits

Author SHA1 Message Date
Luke Dashjr 9238ecb417 Policy: MOVEONLY: 3 functions to policy.o:
- [script/standard.o] IsStandard
- [main.o] IsStandardTx
- [main.o] AreInputsStandard

Also, don't use namespace std in policy.cpp
2015-06-26 17:59:10 +02:00
Wladimir J. van der Laan 41076aad0c
Merge pull request #6124
ffd75ad Enable CHECKLOCKTIMEVERIFY as a standard script verify flag (Peter Todd)
bc60b2b Replace NOP2 with CHECKLOCKTIMEVERIFY (BIP65) (Peter Todd)
48e9c57 Move LOCKTIME_THRESHOLD to src/script/script.h (Peter Todd)
99088d6 Make CScriptNum() take nMaxNumSize as an argument (Peter Todd)
2015-06-26 14:42:45 +02:00
Peter Todd bc60b2b4b4 Replace NOP2 with CHECKLOCKTIMEVERIFY (BIP65)
<nLockTime> CHECKLOCKTIMEVERIFY -> <nLockTime>

Fails if tx.nLockTime < nLockTime, allowing the funds in a txout to be
locked until some block height or block time in the future is reached.

Only the logic and unittests are implemented; this commit does not have
any actual soft-fork logic in it.

Thanks to Pieter Wuille for rebase.

Credit goes to Gregory Maxwell for the suggestion of comparing the
argument against the transaction nLockTime rather than the current
time/blockheight directly.
2015-06-21 23:56:28 -04:00
Jonas Schnelli 9a8897f4ac Remove JSON Spirit wrapper, remove JSON Spirit leftovers
- implement find_value() function for UniValue
- replace all Array/Value/Object types with UniValues, remove JSON Spirit to UniValue wrapper
- remove JSON Spirit sources
2015-06-04 09:16:21 +02:00
Jonas Schnelli 3df0411ad9 remove JSON Spirit UniValue wrapper 2015-06-04 09:16:06 +02:00
Jonas Schnelli 53b4671a9d extend conversion to UniValue 2015-06-04 09:16:05 +02:00
Jeff Garzik 15982a8b69 Convert tree to using univalue. Eliminate all json_spirit uses. 2015-06-04 09:16:05 +02:00
jtimon da29ecbcc6 Consensus: MOVEONLY: Move CValidationState from main consensus/validation 2015-05-15 16:05:28 +02:00
Wladimir J. van der Laan 92fd887fd4 tests: add a BasicTestingSetup and apply to all tests
Make sure that chainparams and logging is properly initialized. Doing
this for every test may be overkill, but this initialization is so
simple that that does not matter.

This should fix the travis issues.
2015-03-12 09:45:22 +01:00
Wladimir J. van der Laan fcf646c9b0
Merge pull request #5286
44e9a6b Update the 'test_IsStandard' unit test (Flavien Charlon)
a930658 Change the default maximum OP_RETURN size to 80 bytes (Flavien Charlon)
2015-02-03 13:12:44 +01:00
Pieter Wuille 9fddceda44 Avoid storing a reference passed to SignatureChecker constructors 2015-02-02 20:19:46 -08:00
Pieter Wuille 858809a33e Use separate SignatureChecker for CMutableTransaction 2015-02-02 20:19:12 -08:00
Wladimir J. van der Laan 48e1765e27
Merge pull request #5143
da918ac Make SCRIPT_VERIFY_CLEANSTACK a standardness requirement (Pieter Wuille)
b6e03cc Add SCRIPT_VERIFY_CLEANSTACK (BIP62 rule 6) (Pieter Wuille)
ae4151b No semantic change: reuse stack variable in P2SH evaluation (Pieter Wuille)
2015-01-08 12:01:22 +01:00
Wladimir J. van der Laan 729ba31749
Merge pull request #5513
856e862 namespace: drop most boost namespaces and a few header cleanups (Cory Fields)
9b1ab86 namespace: drop boost::assign altogether here (Cory Fields)
a324199 namespace: remove boost namespace pollution (Cory Fields)
2015-01-06 20:32:45 +01:00
Wladimir J. van der Laan 34cdc41128 String conversions uint256 -> uint256S
If uint256() constructor takes a string, uint256(0) will become
dangerous when uint256 does not take integers anymore (it will go
through std::string(const char*) making a NULL string, and the explicit
keyword is no help).
2015-01-05 15:45:35 +01:00
Cory Fields 856e862f4a namespace: drop most boost namespaces and a few header cleanups
A few boost::asio were left around because they're very wordy otherwise.
2015-01-02 15:12:03 -05:00
Michael Ford 78253fcbad Remove references to X11 licence 2014-12-16 15:56:50 +08:00
Pieter Wuille b6e03cc592 Add SCRIPT_VERIFY_CLEANSTACK (BIP62 rule 6)
Based on an earlier patch by Peter Todd, though the rules here are different
(P2SH scripts should not have a CLEANSTACK check before the P2SH evaluation).
2014-11-25 12:38:01 +01:00
Peter Todd 03914234b3
Discourage NOPs reserved for soft-fork upgrades
NOP1 to NOP10 are reserved for future soft-fork upgrades. In the event
of an upgrade such NOPs have *VERIFY behavior, meaning that if their
arguments are not correct the script fails. Discouraging these NOPs by
rejecting transactions containing them from the mempool ensures that
we'll never accept transactions, nor mine blocks, with scripts that are
now invalid according to the majority of hashing power even if we're not
yet upgraded. Previously this wasn't an issue as the IsStandard() rules
didn't allow upgradable NOPs anyway, but 7f3b4e95 relaxed the
IsStandard() rules for P2SH redemptions allowing any redeemScript to be
spent.

We *do* allow upgradable NOPs in scripts so long as they are not
executed. This is harmless as there is no opportunity for the script to
be invalid post-upgrade.
2014-11-17 22:22:33 -05:00
Flavien Charlon 44e9a6b22e Update the 'test_IsStandard' unit test
The maximum length for the payload of an OP_RETURN output is now
80 bytes, and unit tests must be modified to account for the change.
2014-11-16 15:43:12 +00:00
Cory Fields 219a1470c4 script: check ScriptError values in script tests 2014-11-14 16:25:53 -05:00
Cory Fields 71697f97d3 Separate protocol versioning from clientversion 2014-10-29 00:24:40 -04:00
Pieter Wuille 698c6abb25 Add SCRIPT_VERIFY_MINIMALDATA (BIP62 rules 3 and 4)
Also use the new flag as a standard rule, and replace the IsCanonicalPush
standardness check with it (as it is more complete).
2014-10-25 03:03:20 -07:00
Pieter Wuille d752ba86c1 Add SCRIPT_VERIFY_SIGPUSHONLY (BIP62 rule 2) 2014-10-25 03:03:16 -07:00
Cory Fields e9ca4280f3 script: add ToByteVector() for converting anything with begin/end
This should move to a util header once their dependencies are cleaned up.
2014-10-17 13:44:14 -04:00
Pieter Wuille 9df9cf5a9f Make SCRIPT_VERIFY_STRICTENC compatible with BIP62
* Delete canonical_tests.cpp, and move the tests to script_tests.cpp.
* Split off SCRIPT_VERIFY_DERSIG from SCRIPT_VERIFY_STRICTENC (the BIP62 part of it).
* Change signature STRICTENC/DERSIG semantics to fail the script entirely rather than the CHECKSIG result (softfork safety, and BIP62 requirement).
* Add many autogenerated tests for several odd cases.
* Mention specific BIP62 rules in the script verification flags.
2014-10-08 15:42:29 -07:00
Pieter Wuille d4a42334d4
Merge pull request #4834
7c70438 Get rid of the dummy CCoinsViewCache constructor arg (Pieter Wuille)
ed27e53 Add coins_tests with a large randomized CCoinViewCache test. (Pieter Wuille)
058b08c Do not keep fully spent but unwritten CCoins entries cached. (Pieter Wuille)
c9d1a81 Get rid of CCoinsView's SetCoins and SetBestBlock. (Pieter Wuille)
f28aec0 Use ModifyCoins instead of mutable GetCoins. (Pieter Wuille)
2014-10-08 14:58:16 -07:00
Pieter Wuille e790c370b5 Replace SCRIPT_VERIFY_NOCACHE by flag directly to checker 2014-10-02 20:26:58 +02:00
Pieter Wuille 8138cbea3c Add automatic script test generation, and actual checksig tests 2014-09-26 21:58:48 +02:00
Pieter Wuille 7c70438dc6 Get rid of the dummy CCoinsViewCache constructor arg 2014-09-24 03:19:04 +02:00
Pieter Wuille c9d1a81ce7 Get rid of CCoinsView's SetCoins and SetBestBlock.
All direct modifications are now done through ModifyCoins, and BatchWrite is
used for pushing batches of queued modifications up, so we don't need the
low-level SetCoins and SetBestBlock anymore in the top-level CCoinsView class.
2014-09-23 22:29:21 +02:00
Wladimir J. van der Laan 438c7e4cd2
Merge pull request #4555
6dcfda2 Don't pass nHashType to EvalScript nor CheckSig (jtimon)
2b23a87 Don't pass nHashType to VerifyScript (jtimon)
ce3649fb Remove CScriptCheck::nHashType (was always 0) (jtimon)
358562b Remove unused function main:VerifySignature (jtimon)
2014-09-17 13:44:22 +02:00
Pieter Wuille 0be990ba34 Move CTxDestination from script/script to script/standard 2014-09-16 19:14:32 +02:00
jtimon 2b23a87599 Don't pass nHashType to VerifyScript 2014-09-12 20:04:31 +02:00
Pieter Wuille 6022b5dc6b Make script_{valid,invalid}.json validation flags configurable 2014-09-08 22:38:26 +02:00
jtimon cbd22a50c4 Move CScript class and dependencies to script/script 2014-09-08 20:19:31 +02:00
jtimon 86dbeea2cd Rename script.h/.cpp to scriptutils.h/.cpp (plus remove duplicated includes) 2014-09-08 20:19:31 +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
Wladimir J. van der Laan e443ed2462
Fix transaction tests
Conflict between low-s (6fd7ef2) and test updates in d3a33fc.
2014-05-09 16:35:30 +02:00
Peter Todd 6380180821 Add rejection of non-null CHECKMULTISIG dummy values
This is a source of transaction mutability as the dummy value was
previously not checked and could be modified to something other than the
usual OP_0 value.
2014-05-08 00:55:01 -04:00
Peter Todd 29c17498a5 Let tx (in)valid tests use any SCRIPT_VERIFY flag
Previously only P2SH could be set.
2014-05-05 05:59:59 -04:00
Wladimir J. van der Laan ed67100565 Add required locks in tests
Unit tests with DEBUG_LOCKORDER were running into assertions.
2014-04-23 08:05:05 +02: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
Gavin Andresen ae7e5d7ceb Merge pull request #3737 from jgarzik/op-return-size
script: reduce OP_RETURN standard relay bytes to 40
2014-02-26 13:52:56 -05:00
Jeff Garzik 8175c790eb script: reduce OP_RETURN standard relay bytes to 40
Per mailing list discussion.
2014-02-26 12:58:08 -05:00
Mike Hearn 6a4c196dd6 Drop fees by 10x due to the persistently higher exchange rate.
The last fee drop was by 5x (from 50k satoshis to 10k satoshis)
in the 0.8.2 release which was about 6 months ago.

The current fee is (assuming a $500 exchange rate) about 5 dollar
cents. The new fee after this patch is 0.5 cents.

Miners who prefer the higher fees are obviously still able to
use the command line flags to override this setting. Miners who
choose to create smaller blocks will select the highest-fee paying
transactions anyway.

This would hopefully be the last manual adjustment ever required
before floating fees become normal.
2013-11-26 15:56:28 +04: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
Gavin Andresen 837369806a Merge pull request #3128
0056095 Show short scriptPubKeys correctly (Peter Todd)
22de68d Relay OP_RETURN TxOut as standard transaction type (Peter Todd)

Signed-off-by: Gavin Andresen <gavinandresen@gmail.com>
2013-11-01 12:13:38 +10:00
Peter Todd 22de68dffc
Relay OP_RETURN TxOut as standard transaction type
Also fix decoderawtransaction to not show reqSigs or addresses for
nulldata txouts. (Previous version also left reqSigs uninitialized
mistakenly)
2013-10-24 04:32:35 -04:00