aboutsummaryrefslogtreecommitdiff
path: root/src/script.cpp
AgeCommit message (Collapse)Author
2014-06-21Add CMutableTransaction and make CTransaction immutable.Pieter Wuille
In addition, introduce a cached hash inside CTransaction, to prevent recalculating it over and over again.
2014-06-21Add built-in RIPEMD-160 implementationPieter Wuille
2014-06-21Move crypto implementations to src/crypto/Pieter Wuille
2014-06-21Add built-in SHA-1 implementation.Pieter Wuille
2014-06-21Switch script.cpp and hash.cpp to use sha2.cpp instead of OpenSSL.Pieter Wuille
2014-06-10Remove unused Print/PrintHex functionsWladimir J. van der Laan
You can just use HexStr(script) or script.ToString() for debugging, no need for these extra functions.
2014-05-31Remove template matching params from GetOpName()Huang Le
Since they are not real opcodes, being reported as OP_UNKNOWN is less confusing for human-readable decoding. Signed-off-by: Huang Le <4tarhl@gmail.com>
2014-05-09Merge pull request #3637Wladimir J. van der Laan
6fd7ef2 Also switch the (unused) verification code to low-s instead of even-s. (Pieter Wuille)
2014-05-09Merge pull request #3843Wladimir J. van der Laan
787ee0c Check redeemScript size does not exceed 520 byte limit (Peter Todd) 4d79098 Increase IsStandard() scriptSig length (Peter Todd) f80cffa Do not trigger a DoS ban if SCRIPT_VERIFY_NULLDUMMY fails (Peter Todd) 6380180 Add rejection of non-null CHECKMULTISIG dummy values (Peter Todd) 29c1749 Let tx (in)valid tests use any SCRIPT_VERIFY flag (Peter Todd) 68f7d1d Create (MANDATORY|STANDARD)_SCRIPT_VERIFY_FLAGS constants (Peter Todd)
2014-05-08Add rejection of non-null CHECKMULTISIG dummy valuesPeter Todd
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-05Create (MANDATORY|STANDARD)_SCRIPT_VERIFY_FLAGS constantsPeter Todd
2014-04-22script: remove bignum dependencyCory Fields
2014-04-22script: switch to CScriptNum usage for scriptsCory Fields
2014-03-10Also switch the (unused) verification code to low-s instead of even-s.Pieter Wuille
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.
2014-02-26script: reduce OP_RETURN standard relay bytes to 40Jeff Garzik
Per mailing list discussion.
2014-02-21script: tighten multisig non-standard rules: do not relay pubkeys above 65 bytesJeff Garzik
2014-02-11Add HasCanonicalPushes(), and use it in IsStandardTxPieter Wuille
2014-02-11Move IsPushOnly() to script.cppPieter Wuille
2013-11-20Merge pull request #3257Wladimir J. van der Laan
379778b core: remove includes in .cpp, if header is already in .h (Philip Kaufmann)
2013-11-15orphan spaces cleanup ;-)Philip Kaufmann
2013-11-15core: remove includes in .cpp, if header is already in .hPhilip Kaufmann
- example: if util.h includes stdint.h, remove it from util.cpp, as util.h is the first header included in util.cpp
2013-11-10Cleanup code using forward declarations.Brandon Dahler
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-10-24Relay OP_RETURN TxOut as standard transaction typePeter Todd
Also fix decoderawtransaction to not show reqSigs or addresses for nulldata txouts. (Previous version also left reqSigs uninitialized mistakenly)
2013-10-21Merge pull request #2738 from jgarzik/op_returnGavin Andresen
Relay OP_RETURN data TxOut as standard transaction type.
2013-10-20Merge pull request #3119Pieter Wuille
db0e8cc Bump Year Number to 2013 (super3)
2013-10-20Bump Year Number to 2013super3
2013-10-02Relay OP_RETURN data TxOut as standard transaction typeJeff Garzik
2013-09-28Inline signature serializerPieter Wuille
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-18Replace printf with LogPrintf / LogPrintGavin Andresen
2013-08-25Merge pull request #2938 from petertodd/op-reserved-weirdnessGavin Andresen
Document and test OP_RESERVED weirdness
2013-08-25Document and test OP_RESERVED weirdnessPeter Todd
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-24Merge pull request #2618 from fcicq/solaris-supportJeff Garzik
Partial solaris support
2013-08-16Only create signatures with even S, and verification mode to check.Pieter Wuille
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.
2013-07-31Remove #define loop from util.hGavin Andresen
Replace the loop macro with while (true). The #define caused problems for Qt.
2013-07-17Fix boost uint type bug by reordering the includesfcicq
2013-06-22Add ExtractAffectedKeys to scriptPieter Wuille
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).
2013-06-05Removed script.cpp's dependence on main.hEric Lombrozo
2013-05-30Make signature cache store CPubKeysPieter Wuille
2013-05-30CSecret/CKey -> CKey/CPubKey split/refactorPieter Wuille
2013-05-30Make CPubKey statically allocatedPieter Wuille
2013-05-02Remove implementation of disabled opcodesGavin Andresen
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.
2013-01-23Merge pull request #2114 from sipa/strictstrictGavin Andresen
Make IsCanonicalScript() check the hash type more thoroughly
2013-01-18Replace 520 constant with MAX_SCRIPT_ELEMENT_SIZEMatt Corallo
2013-01-08Remove contention on signature cache during block validationPieter Wuille
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
2013-01-08Move VerifySignature to mainPieter Wuille
2012-12-22Make IsCanonicalScript() check the hash type more thoroughlyPieter Wuille
0 and 128 were previously accepted as standard hash type. Note that this function is not active in the current verification code.
2012-11-21Add assert and comment for subtle pay-to-script-hash logicGavin Andresen
2012-11-15Introduce script verification flagsPieter Wuille
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-10-20Merge pull request #1936 from sipa/morehashwriterPieter Wuille
Use CHashWriter also in SignatureHash(), and for message signing
2012-10-20UltraprunePieter Wuille
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.