aboutsummaryrefslogtreecommitdiff
path: root/src/script.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Implement BIP 66 validation rules and switchover logicPieter Wuille2015-10-181-0/+88
|
* Also switch the (unused) verification code to low-s instead of even-s.Pieter Wuille2014-06-291-3/+6
| | | | | | | | a81cd968 introduced a malleability breaker for signatures (using an even value for S). In e0e14e43 this was changed to the lower of two potential values, rather than the even one. Only the signing code was changed though, the (for now unused) verification code wasn't adapted.
* Add rejection of non-null CHECKMULTISIG dummy valuesPeter Todd2014-06-291-1/+15
| | | | | | 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.
* Create (MANDATORY|STANDARD)_SCRIPT_VERIFY_FLAGS constantsPeter Todd2014-06-291-1/+1
|
* script: remove bignum dependencyCory Fields2014-05-291-1/+0
|
* script: switch to CScriptNum usage for scriptsCory Fields2014-05-291-27/+17
|
* Replaced references to Bitcoin with Dogecoin/Dogecoin Core as appropriate.Ross Nicoll2014-03-281-1/+1
|
* script: reduce OP_RETURN standard relay bytes to 40Jeff Garzik2014-02-261-2/+2
| | | | Per mailing list discussion.
* script: tighten multisig non-standard rules: do not relay pubkeys above 65 bytesJeff Garzik2014-02-211-2/+2
|
* Add HasCanonicalPushes(), and use it in IsStandardTxPieter Wuille2014-02-111-0/+27
|
* Move IsPushOnly() to script.cppPieter Wuille2014-02-111-0/+18
|
* Merge pull request #3257Wladimir J. van der Laan2013-11-201-2/+0
|\ | | | | | | 379778b core: remove includes in .cpp, if header is already in .h (Philip Kaufmann)
| * core: remove includes in .cpp, if header is already in .hPhilip Kaufmann2013-11-151-2/+0
| | | | | | | | | | - example: if util.h includes stdint.h, remove it from util.cpp, as util.h is the first header included in util.cpp
* | orphan spaces cleanup ;-)Philip Kaufmann2013-11-151-1/+1
|/
* Cleanup code using forward declarations.Brandon Dahler2013-11-101-8/+12
| | | | | | | | | 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.
* Relay OP_RETURN TxOut as standard transaction typePeter Todd2013-10-241-5/+7
| | | | | | Also fix decoderawtransaction to not show reqSigs or addresses for nulldata txouts. (Previous version also left reqSigs uninitialized mistakenly)
* Merge pull request #2738 from jgarzik/op_returnGavin Andresen2013-10-211-2/+19
|\ | | | | Relay OP_RETURN data TxOut as standard transaction type.
| * Relay OP_RETURN data TxOut as standard transaction typeJeff Garzik2013-10-021-2/+19
| |
* | Merge pull request #3119Pieter Wuille2013-10-201-1/+1
|\ \ | | | | | | | | | db0e8cc Bump Year Number to 2013 (super3)
| * | Bump Year Number to 2013super32013-10-201-1/+1
| |/
* / Inline signature serializerPieter Wuille2013-09-281-45/+101
|/ | | | | | | | | | | | | | | | 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.
* Replace printf with LogPrintf / LogPrintGavin Andresen2013-09-181-2/+2
|
* Merge pull request #2938 from petertodd/op-reserved-weirdnessGavin Andresen2013-08-251-0/+2
|\ | | | | Document and test OP_RESERVED weirdness
| * Document and test OP_RESERVED weirdnessPeter Todd2013-08-251-0/+2
| | | | | | | | | | | | 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.
* | Merge pull request #2618 from fcicq/solaris-supportJeff Garzik2013-08-241-6/+6
|\ \ | |/ |/| Partial solaris support
| * Fix boost uint type bug by reordering the includesfcicq2013-07-171-6/+6
| |
* | Only create signatures with even S, and verification mode to check.Pieter Wuille2013-08-161-9/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To fix a minor malleability found by Sergio Lerner (reported here: https://bitcointalk.org/index.php?topic=8392.msg1245898#msg1245898) The problem is that if (R,S) is a valid ECDSA signature for a given message and public key, (R,-S) is also valid. Modulo N (the order of the secp256k1 curve), this means that both (R,S) and (R,N-S) are valid. Given that N is odd, S and N-S have a different lowest bit. We solve the problem by forcing signatures to have an even S value, excluding one of the alternatives. This commit just changes the signing code to always produce even S values, and adds a verification mode to check it. This code is not enabled anywhere yet. Existing tests in key_tests.cpp verify that the produced signatures are still valid.
* | Remove #define loop from util.hGavin Andresen2013-07-311-1/+1
|/ | | | | Replace the loop macro with while (true). The #define caused problems for Qt.
* Add ExtractAffectedKeys to scriptPieter Wuille2013-06-221-0/+36
| | | | | | This function finds all keys affected by a particular output script, supporting everything ExtractDestinations supports (pay-to-pubkey, pay-to-pubkeyhash, multisig) and recurses into subscripts (P2SH).
* Removed script.cpp's dependence on main.hEric Lombrozo2013-06-051-1/+1
|
* Make signature cache store CPubKeysPieter Wuille2013-05-301-8/+12
|
* CSecret/CKey -> CKey/CPubKey split/refactorPieter Wuille2013-05-301-21/+12
|
* Make CPubKey statically allocatedPieter Wuille2013-05-301-2/+3
|
* Remove implementation of disabled opcodesGavin Andresen2013-05-021-166/+1
| | | | | So we stop getting pull requests (like #2604) fixing problems with disabled Script opcodes. A hard fork would be required to re-enable these, and if we ever did that we'd require extensive review and testing.
* Merge pull request #2114 from sipa/strictstrictGavin Andresen2013-01-231-1/+2
|\ | | | | Make IsCanonicalScript() check the hash type more thoroughly
| * Make IsCanonicalScript() check the hash type more thoroughlyPieter Wuille2012-12-221-1/+2
| | | | | | | | | | | | | | 0 and 128 were previously accepted as standard hash type. Note that this function is not active in the current verification code.
* | Replace 520 constant with MAX_SCRIPT_ELEMENT_SIZEMatt Corallo2013-01-181-2/+2
| |
* | Remove contention on signature cache during block validationPieter Wuille2013-01-081-9/+11
| | | | | | | | | | | | | | | | Since block validation happens in parallel, multiple threads may be accessing the signature cache simultaneously. To prevent contention: * Turn the signature cache lock into a shared mutex * Make reading from the cache only acquire a shared lock * Let block validations not store their results in the cache
* | Move VerifySignature to mainPieter Wuille2013-01-081-11/+0
|/
* Add assert and comment for subtle pay-to-script-hash logicGavin Andresen2012-11-211-0/+5
|
* Introduce script verification flagsPieter Wuille2012-11-151-13/+13
| | | | | | | | 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.
* Merge pull request #1936 from sipa/morehashwriterPieter Wuille2012-10-201-3/+2
|\ | | | | Use CHashWriter also in SignatureHash(), and for message signing
| * Use CHashWriter also in SignatureHash(), and for message signingPieter Wuille2012-10-191-3/+2
| |
* | UltraprunePieter Wuille2012-10-201-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This switches bitcoin's transaction/block verification logic to use a "coin database", which contains all unredeemed transaction output scripts, amounts and heights. The name ultraprune comes from the fact that instead of a full transaction index, we only (need to) keep an index with unspent outputs. For now, the blocks themselves are kept as usual, although they are only necessary for serving, rescanning and reorganizing. The basic datastructures are CCoins (representing the coins of a single transaction), and CCoinsView (representing a state of the coins database). There are several implementations for CCoinsView. A dummy, one backed by the coins database (coins.dat), one backed by the memory pool, and one that adds a cache on top of it. FetchInputs, ConnectInputs, ConnectBlock, DisconnectBlock, ... now operate on a generic CCoinsView. The block switching logic now builds a single cached CCoinsView with changes to be committed to the database before any changes are made. This means no uncommitted changes are ever read from the database, and should ease the transition to another database layer which does not support transactions (but does support atomic writes), like LevelDB. For the getrawtransaction() RPC call, access to a txid-to-disk index would be preferable. As this index is not necessary or even useful for any other part of the implementation, it is not provided. Instead, getrawtransaction() uses the coin database to find the block height, and then scans that block to find the requested transaction. This is slow, but should suffice for debug purposes.
* | Compact serialization for scriptsPieter Wuille2012-10-201-0/+125
| | | | | | | | | | | | | | | | | | | | | | Special serializers for script which detect common cases and encode them much more efficiently. 3 special cases are defined: * Pay to pubkey hash (encoded as 21 bytes) * Pay to script hash (encoded as 21 bytes) * Pay to pubkey starting with 0x02, 0x03 or 0x04 (encoded as 33 bytes) Other scripts up to 121 bytes require 1 byte + script length. Above that, scripts up to 16505 bytes require 2 bytes + script length.
* | Merge pull request #1742 from sipa/canonicalJeff Garzik2012-10-201-13/+79
|\ \ | |/ |/| Check for canonical public keys and signatures
| * Check for canonical public keys and signaturesPieter Wuille2012-09-211-13/+79
| | | | | | | | Only enabled inside tests for now.
* | Documented bug in sign-extension behavior of opcodes OP_AND, OP_OR, and OP_XOR.Mark Friedenbach2012-09-251-1/+23
|/ | | | Due to a bug in the implementation of MakeSameSize(), using OP_AND, OP_OR, or OP_XOR with signed values of unequal size will result in the sign-value becoming part of the smaller integer, with nonsensical results. This patch documents the unexpected behavior and provides the basis of a solution should decision be made to fix the bug in the future.
* Avoid leaving return types or function attributes on their own lines.Gregory Maxwell2012-08-241-2/+1
|
* Bugfix: Correct English grammar regarding "'s"Luke Dashjr2012-08-011-1/+1
|