aboutsummaryrefslogtreecommitdiff
path: root/src/script.h
Commit message (Collapse)AuthorAgeFilesLines
* Rename script.h/.cpp to scriptutils.h/.cpp (plus remove duplicated includes)jtimon2014-09-081-815/+0
|
* Discover some missing includesjtimon2014-09-021-1/+0
|
* Remove unused function StackString() and class CCoins;jtimon2014-09-021-20/+0
|
* add missing header end commentsPhilip Kaufmann2014-08-281-1/+1
| | | | | | - ensures a consistent usage in header files - also add a blank line after the copyright header where missing - also remove orphan new-lines at the end of some files
* Split up util.cpp/hWladimir J. van der Laan2014-08-261-1/+2
| | | | | | | | | | | | | | | | Split up util.cpp/h into: - string utilities (hex, base32, base64): no internal dependencies, no dependency on boost (apart from foreach) - money utilities (parsesmoney, formatmoney) - time utilities (gettime*, sleep, format date): - and the rest (logging, argument parsing, config file parsing) The latter is basically the environment and OS handling, and is stripped of all utility functions, so we may want to rename it to something else than util.cpp/h for clarity (Matt suggested osinterface). Breaks dependency of sha256.cpp on all the things pulled in by util.
* Make CScript::clear() release its memoryPieter Wuille2014-08-241-0/+6
|
* Merge pull request #4602Wladimir J. van der Laan2014-08-031-1/+1
|\ | | | | | | 6fd59ee script.h: set_vch() should shift a >32 bit value (Jeff Garzik)
| * script.h: set_vch() should shift a >32 bit valueJeff Garzik2014-07-291-1/+1
| | | | | | | | Source: http://www.viva64.com/en/b/0268/
* | Declare SignatureHash() in script.hjtimon2014-08-011-0/+1
|/
* replaced MINE_ with ISMINE_JaSK2014-07-021-4/+4
|
* Added MINE_ALL = (spendable|watchonly)JaSK2014-07-021-0/+1
|
* Use script matching rather than destination matching for watch-only.Pieter Wuille2014-07-021-1/+1
| | | | | | | | | | | | | | | | | | | This changes the keystore data format, wallet format and IsMine logic to detect watch-only outputs based on direct script matching rather than first trying to convert outputs to destinations (addresses). The reason is that we don't know how the software that has the spending keys works. It may support the same types of scripts as us, but that is not guaranteed. Furthermore, it removes the ambiguity between addresses used as identifiers for output scripts or identifiers for public keys. One practical implication is that adding a normal pay-to-pubkey-hash address via importaddress will not cause payments to the corresponding full public key to be detected as IsMine. If that is wanted, add those scripts directly (importaddress now also accepts any hex-encoded script). Conflicts: src/wallet.cpp
* Watchonly balances are shown separately in gui.JaSK2014-07-021-0/+2
|
* Add support for watch-only addressesPieter Wuille2014-07-021-2/+10
| | | | | | | | | | | | | | | | | | | | | | Changes: * Add Add/Have WatchOnly methods to CKeyStore, and implementations in CBasicKeyStore. * Add similar methods to CWallet, and support entries for it in CWalletDB. * Make IsMine in script/wallet return a new enum 'isminetype', rather than a boolean. This allows distinguishing between spendable and unspendable coins. * Add a field fSpendable to COutput (GetAvailableCoins' return type). * Mark watchonly coins in listunspent as 'watchonly': true. * Add 'watchonly' to validateaddress, suppressing script/pubkey/... in this case. Based on a patch by Eric Lombrozo. Conflicts: src/qt/walletmodel.cpp src/rpcserver.cpp src/wallet.cpp
* Remove timing-based signature cache unit testGavin Andresen2014-06-251-1/+1
| | | | | | | | | | | | | | | | | Two changes: First removes a unit test that fails in my development environment (OSX, compiled -g3 with clang). sipa says that's not terribly surprising; the CMutableTransaction change makes signing a little more expensive but verification quicker. The unit test timed sign+verify-uncached versus verify-cached-five-times. He also says the test will be invalid when libsec256kp1 is integrated (because validation is super-optimized over signing). core.h change fixes a compiler warning (clang -Wall : CMutableTransaction defined as struct, declared as class in script.h).
* Avoid undefined behavior using CFlatData in CScript serializationWladimir J. van der Laan2014-06-231-4/+4
| | | | | | | | | | | | | | | `&vch[vch.size()]` and even `&vch[0]` on vectors can cause assertion errors with VC in debug mode. This is the problem mentioned in #4239. The deeper problem with this is that we rely on undefined behavior. - Add `begin_ptr` and `end_ptr` functions that get the beginning and end pointer of vector in a reliable way that copes with empty vectors and doesn't reference outside the vector (see https://stackoverflow.com/questions/1339470/how-to-get-the-address-of-the-stdvector-buffer-start-most-elegantly/1339767#1339767). - Add a convenience constructor to CFlatData that wraps a vector. I added `begin_ptr` and `end_ptr` as separate functions as I imagine they will be useful in more places.
* Add CMutableTransaction and make CTransaction immutable.Pieter Wuille2014-06-211-2/+3
| | | | | In addition, introduce a cached hash inside CTransaction, to prevent recalculating it over and over again.
* Remove unused Print/PrintHex functionsWladimir J. van der Laan2014-06-101-11/+0
| | | | | You can just use HexStr(script) or script.ToString() for debugging, no need for these extra functions.
* Remove redundant c_strR E Broadley2014-05-221-1/+1
|
* Merge pull request #3637Wladimir J. van der Laan2014-05-091-1/+1
|\ | | | | | | 6fd7ef2 Also switch the (unused) verification code to low-s instead of even-s. (Pieter Wuille)
| * Also switch the (unused) verification code to low-s instead of even-s.Pieter Wuille2014-03-101-1/+1
| | | | | | | | | | | | | | | | 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.
* | Merge pull request #3843Wladimir J. van der Laan2014-05-091-0/+20
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | 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)
| * | Do not trigger a DoS ban if SCRIPT_VERIFY_NULLDUMMY failsPeter Todd2014-05-081-0/+6
| | |
| * | Add rejection of non-null CHECKMULTISIG dummy valuesPeter Todd2014-05-081-1/+3
| | | | | | | | | | | | | | | | | | 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-05-051-0/+12
| |/
* | script: remove bignum dependencyCory Fields2014-04-221-8/+0
| |
* | script: switch to CScriptNum usage for scriptsCory Fields2014-04-221-40/+11
| |
* | script: add CScriptNum classCory Fields2014-04-221-0/+149
|/ | | | | This class holds an int64_t and replaces the use of CBigInt for script integrals.
* script: reduce OP_RETURN standard relay bytes to 40Jeff Garzik2014-02-261-0/+1
| | | | Per mailing list discussion.
* Add HasCanonicalPushes(), and use it in IsStandardTxPieter Wuille2014-02-111-1/+4
|
* Move IsPushOnly() to script.cppPieter Wuille2014-02-111-17/+1
|
* Cleanup code using forward declarations.Brandon Dahler2013-11-101-25/+30
| | | | | | | | | 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.
* Merge pull request #2738 from jgarzik/op_returnGavin Andresen2013-10-211-1/+3
|\ | | | | Relay OP_RETURN data TxOut as standard transaction type.
| * Relay OP_RETURN data TxOut as standard transaction typeJeff Garzik2013-10-021-1/+3
| |
* | Bump Year Number to 2013super32013-10-201-1/+1
|/
* Merge pull request #2791 from sipa/provepruneGavin Andresen2013-09-231-0/+7
|\ | | | | Prune provably-unspendable outputs
| * Prune provably-unspendable outputsPieter Wuille2013-07-101-0/+7
| |
* | Replace printf with LogPrintf / LogPrintGavin Andresen2013-09-181-2/+2
| |
* | Document and test OP_RESERVED weirdnessPeter Todd2013-08-251-0/+4
| | | | | | | | | | | | 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.
* | Only create signatures with even S, and verification mode to check.Pieter Wuille2013-08-161-5/+6
|/ | | | | | | | | | | | | | | | | 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.
* Add ExtractAffectedKeys to scriptPieter Wuille2013-06-221-0/+1
| | | | | | 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 AcceptToMemoryPool method from CTransaction. This method belongs to ↵Eric Lombrozo2013-06-051-1/+1
| | | | | | | | | | | | | | | | | the mempool instance. Removed AreInputsStandard from CTransaction, made it a regular function in main. Moved CTransaction::GetOutputFor to CCoinsViewCache. Moved GetLegacySigOpCount and GetP2SHSigOpCount out of CTransaction into regular functions in main. Moved GetValueIn and HaveInputs from CTransaction into CCoinsViewCache. Moved AllowFree, ClientCheckInputs, CheckInputs, UpdateCoins, and CheckTransaction out of CTransaction and into main. Moved IsStandard and IsFinal out of CTransaction and put them in main as IsStandardTx and IsFinalTx. Moved GetValueOut out of CTransaction into main. Moved CTxIn, CTxOut, and CTransaction into core. Added minimum fee parameter to CTxOut::IsDust() temporarily until CTransaction is moved to core.h so that CTxOut needn't know about CTransaction.
* CSecret/CKey -> CKey/CPubKey split/refactorPieter Wuille2013-05-301-2/+2
|
* Make CPubKey statically allocatedPieter Wuille2013-05-301-2/+4
|
* Replace 520 constant with MAX_SCRIPT_ELEMENT_SIZEMatt Corallo2013-01-181-0/+2
|
* Merge pull request #2060 from sipa/parallelGavin Andresen2013-01-171-3/+2
|\ | | | | Parallel script verification
| * Remove contention on signature cache during block validationPieter Wuille2013-01-081-0/+1
| | | | | | | | | | | | | | | | 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-3/+1
| |
* | Fix clang warningsGavin Andresen2013-01-151-2/+2
|/
* Introduce script verification flagsPieter Wuille2012-11-151-3/+10
| | | | | | | | 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.