aboutsummaryrefslogtreecommitdiff
path: root/src/script.h
AgeCommit message (Collapse)Author
2014-09-08Rename script.h/.cpp to scriptutils.h/.cpp (plus remove duplicated includes)jtimon
2014-09-02Discover some missing includesjtimon
2014-09-02Remove unused function StackString() and class CCoins;jtimon
2014-08-28add missing header end commentsPhilip Kaufmann
- 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
2014-08-26Split up util.cpp/hWladimir J. van der Laan
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.
2014-08-24Make CScript::clear() release its memoryPieter Wuille
2014-08-03Merge pull request #4602Wladimir J. van der Laan
6fd59ee script.h: set_vch() should shift a >32 bit value (Jeff Garzik)
2014-08-01Declare SignatureHash() in script.hjtimon
2014-07-29script.h: set_vch() should shift a >32 bit valueJeff Garzik
Source: http://www.viva64.com/en/b/0268/
2014-07-02replaced MINE_ with ISMINE_JaSK
2014-07-02Added MINE_ALL = (spendable|watchonly)JaSK
2014-07-02Use script matching rather than destination matching for watch-only.Pieter Wuille
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
2014-07-02Watchonly balances are shown separately in gui.JaSK
2014-07-02Add support for watch-only addressesPieter Wuille
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
2014-06-25Remove timing-based signature cache unit testGavin Andresen
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).
2014-06-23Avoid undefined behavior using CFlatData in CScript serializationWladimir J. van der Laan
`&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.
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-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-22Remove redundant c_strR E Broadley
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-08Do not trigger a DoS ban if SCRIPT_VERIFY_NULLDUMMY failsPeter 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-04-22script: add CScriptNum classCory Fields
This class holds an int64_t and replaces the use of CBigInt for script integrals.
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-11Add HasCanonicalPushes(), and use it in IsStandardTxPieter Wuille
2014-02-11Move IsPushOnly() to script.cppPieter Wuille
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-21Merge pull request #2738 from jgarzik/op_returnGavin Andresen
Relay OP_RETURN data TxOut as standard transaction type.
2013-10-20Bump Year Number to 2013super3
2013-10-02Relay OP_RETURN data TxOut as standard transaction typeJeff Garzik
2013-09-23Merge pull request #2791 from sipa/provepruneGavin Andresen
Prune provably-unspendable outputs
2013-09-18Replace printf with LogPrintf / LogPrintGavin Andresen
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-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-10Prune provably-unspendable outputsPieter Wuille
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 AcceptToMemoryPool method from CTransaction. This method belongs to ↵Eric Lombrozo
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.
2013-05-30CSecret/CKey -> CKey/CPubKey split/refactorPieter Wuille
2013-05-30Make CPubKey statically allocatedPieter Wuille
2013-01-18Replace 520 constant with MAX_SCRIPT_ELEMENT_SIZEMatt Corallo
2013-01-17Merge pull request #2060 from sipa/parallelGavin Andresen
Parallel script verification
2013-01-15Fix clang warningsGavin Andresen
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-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.