aboutsummaryrefslogtreecommitdiff
path: root/src/script.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
|
* Bugfix: Fix a variety of misspellingsLuke Dashjr2012-08-011-4/+4
|
* Use unsigned ints to fix signed/unsigned warningsGavin Andresen2012-07-051-6/+7
|
* Implement raw transaction RPC callsGavin Andresen2012-07-051-10/+129
| | | | | | Implement listunspent / getrawtransaction / createrawtransaction / signrawtransaction, to support creation and signing-on-multiple-device multisignature transactions.
* Refactor: SignSignature/VerifyScriptGavin Andresen2012-07-051-13/+14
| | | | | | Minor refactor to support signrawtx signing/verifying transactions when it might only have the previous transaction's txid and txOut.
* Refactor: split CKeyID/CScriptID/CTxDestination from CBitcoinAddressPieter Wuille2012-05-241-47/+70
| | | | | | | | | | | | | | | | | This introduces internal types: * CKeyID: reference (hash160) of a key * CScriptID: reference (hash160) of a script * CTxDestination: a boost::variant of the former two CBitcoinAddress is retrofitted to be a Base58 encoding of a CTxDestination. This allows all internal code to only use the internal types, and only have RPC and GUI depend on the base58 code. Furthermore, the header dependencies are a lot saner now. base58.h is at the top (right below rpc and gui) instead of at the bottom. For the rest: wallet -> script -> keystore -> key. Only keystore still requires a forward declaration of CScript. Solving that would require splitting script into two layers.
* Encapsulate public keys in CPubKeyPieter Wuille2012-05-241-1/+1
|
* Move signature cache from CKey::Verify to CheckSig in script.cppGavin Andresen2012-05-221-4/+75
| | | | | | | | | | | More than doubles the speed of verifying already-cached signatures that use compressed pubkeys: Before: ~200 microseconds After: ~80 microseconds (no caching at all: ~3,300 microseconds per signature) Also encapsulates the signature cache code in a class and fixes a signed/unsigned comparison warning.
* Update License in File HeadersFordy2012-05-181-1/+1
| | | | | | I originally created a pull to replace the "COPYING" in crypter.cpp and crypter.h, but it turned out that COPYING was actually the correct file.
* EvalScript(): cast to avoid signed/unsigned warningJeff Garzik2012-05-011-3/+3
|
* Undo part of c2e8c8ac to fix issue#1148Gavin Andresen2012-04-261-1/+1
|
* Add casts for unavoidable signed/unsigned comparisonsJeff Garzik2012-04-231-4/+4
| | | | | At these code sites, it is preferable to cast rather than change a variable's type.
* SigOp and orphan-tx constants and counts are always unsigned.Jeff Garzik2012-04-231-5/+5
| | | | Fixes several sign-comparison warnings.
* Prefer 'unsigned int' for loop index variables tested against ::size()Jeff Garzik2012-04-221-11/+11
| | | | | | | | | C++ STL ::size() generally returns unsigned, which implies that "int idx" style of loop variable will generate a signed-vs-unsigned comparison warning when testing the loop exit condition "idx < blah.size()" Update areas of the bitcoin code where loop variables may be more properly and correctly defined as unsigned.
* Further reduce header dependenciesPieter Wuille2012-04-171-1/+1
| | | | | | | This commit removes the dependency of serialize.h on PROTOCOL_VERSION, and makes this parameter required instead of implicit. This is much saner, as it makes the places where changing a version number can have an influence obvious.
* Remove headers.hPieter Wuille2012-04-171-1/+7
|
* fix warnings: unused variable 'XX' [-Wunused-variable]Wladimir J. van der Laan2012-04-151-1/+0
|
* Update all copyrights to 2012Gavin Andresen2012-02-071-1/+1
|
* Make transactions with extra data in their scriptSig's non-standard.Gavin Andresen2012-01-191-0/+19
|
* Replace OP_EVAL (BIP 12) with Pay-to-script-hash (BIP 16).Gavin Andresen2012-01-131-102/+136
|
* Remove not-used-anywhere scriptPrereq from SignSignature()Gavin Andresen2012-01-131-7/+4
|
* make sure IsMine only returns true when we own all keyscoderrr2012-01-031-1/+1
|
* Fix OP_EVAL recursion depth countingWladimir J. van der Laan2011-12-271-1/+1
|
* Fix broken ExtractAddress (refactored, made callers check for addresses in ↵Gavin Andresen2011-12-221-2/+2
| | | | keystore if they care)
* Update bitcoin address numbers for latest luke-jr/sipa schemeGavin Andresen2011-12-191-1/+1
|
* Use block times for 'hard' OP_EVAL switchover, and refactored EvalScriptGavin Andresen2011-12-191-57/+38
| | | | | | so it takes a flag for how to interpret OP_EVAL. Also increased IsStandard size of scriptSigs to 500 bytes, so a 3-of-3 multisig transaction IsStandard.
* Interpret OP_EVAL as OP_NOP until Feb 1, 2012Gavin Andresen2011-12-191-0/+12
|
* OP_EVAL implementationGavin Andresen2011-12-191-168/+488
| | | | | | OP_EVAL is a new opcode that evaluates an item on the stack as a script. It enables a new type of bitcoin address that needs an arbitrarily complex script to redeem.
* Support 3 new multisignature IsStandard transactionsGavin Andresen2011-12-191-67/+156
| | | | | Initial support for (a and b), (a or b), and 2-of-3 escrow transactions (where a, b, and c are keys).