aboutsummaryrefslogtreecommitdiff
path: root/src/script.h
Commit message (Collapse)AuthorAgeFilesLines
...
* UltraprunePieter Wuille2012-10-201-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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/+71
| | | | | | | | | | | 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.
* Check for canonical public keys and signaturesPieter Wuille2012-09-211-4/+5
| | | | Only enabled inside tests for now.
* Update Warning-strings to use a standard-formatPhilip Kaufmann2012-08-011-1/+1
| | | | | | | | | - ensure warnings always start with "Warning:" and that the first character after ":" is written uppercase - ensure the first sentence in warnings ends with an "!" - remove unneeded spaces from Warning-strings - add missing Warning-string translation - remove a "\n" and replace with untranslatable "<br><br>"
* Implement raw transaction RPC callsGavin Andresen2012-07-051-0/+4
| | | | | | Implement listunspent / getrawtransaction / createrawtransaction / signrawtransaction, to support creation and signing-on-multiple-device multisignature transactions.
* Refactor: SignSignature/VerifyScriptGavin Andresen2012-07-051-0/+3
| | | | | | Minor refactor to support signrawtx signing/verifying transactions when it might only have the previous transaction's txid and txOut.
* Fix signed/unsigned warnings in {script,serialize}.h (fixes #1541)Matt Corallo2012-07-021-1/+1
|
* Refactor: split CKeyID/CScriptID/CTxDestination from CBitcoinAddressPieter Wuille2012-05-241-11/+27
| | | | | | | | | | | | | | | | | 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-0/+6
|
* 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.
* Add casts for unavoidable signed/unsigned comparisonsJeff Garzik2012-04-231-1/+1
| | | | | 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-2/+2
| | | | Fixes several sign-comparison warnings.
* Add explicit numeric constant value for all opcodesWladimir J. van der Laan2012-04-211-115/+115
| | | | | - Easier for debugging (what opcode was 0x... again?) - Clarifies that the opcodes are set in stone in the protocol, and signals that it is impossible to insert opcodes in between.
* Fix bugs on 'unsigned char' platforms.Dwayne C. Litzenberger2012-04-181-2/+4
| | | | | | | | | | | | | | | | | | In ISO C++, the signedness of 'char' is undefined. On some platforms (e.g. ARM), 'char' is an unsigned type, but some of the code relies on 'char' being signed (as it is on x86). This is indicated by compiler warnings like this: bignum.h: In constructor 'CBigNum::CBigNum(char)': bignum.h:81:59: warning: comparison is always true due to limited range of data type [-Wtype-limits] util.cpp: In function 'bool IsHex(const string&)': util.cpp:427:28: warning: comparison is always false due to limited range of data type [-Wtype-limits] In particular, IsHex erroneously returned true regardless of the input characters, as long as the length of the string was a positive multiple of 2. Note: For testing, it's possible using GCC to force char to be unsigned by adding the -funsigned-char parameter to xCXXFLAGS.
* Begin doxygen-compatible commentsPieter Wuille2012-03-261-1/+3
|
* 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/+1
|
* Replace OP_EVAL (BIP 12) with Pay-to-script-hash (BIP 16).Gavin Andresen2012-01-131-26/+16
|
* Remove not-used-anywhere scriptPrereq from SignSignature()Gavin Andresen2012-01-131-1/+1
|
* Fix broken ExtractAddress (refactored, made callers check for addresses in ↵Gavin Andresen2011-12-221-2/+2
| | | | keystore if they care)
* Revert "Use standard C99 (and Qt) types for 64-bit integers"Wladimir J. van der Laan2011-12-211-8/+6
| | | | This reverts commit 21d9f36781604e4ca9fc35dc65265593423b73e9.
* Use standard C99 (and Qt) types for 64-bit integersLuke Dashjr2011-12-201-6/+8
|
* Use block times for 'hard' OP_EVAL switchover, and refactored EvalScriptGavin Andresen2011-12-191-7/+7
| | | | | | 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.
* OP_EVAL implementationGavin Andresen2011-12-191-170/+52
| | | | | | 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-15/+10
| | | | | Initial support for (a and b), (a or b), and 2-of-3 escrow transactions (where a, b, and c are keys).
* Merge pull request #458 from TheBlueMatt/copyrightGavin Andresen2011-08-111-0/+1
|\ | | | | Unify copyright notices.
| * Unify copyright notices.Matt Corallo2011-08-091-0/+1
| | | | | | | | | | | | To a variation on: // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2011 The Bitcoin developers
* | Add prototype for EvalScript() to script.hVegard Nossum2011-08-081-0/+1
| | | | | | | | This is needed for the script unit tests.
* | Add missing include to script.hVegard Nossum2011-08-081-0/+2
|/
* Use CBitcoinAddress instead of string/uint160Pieter Wuille2011-07-171-24/+6
| | | | | | Instead of conversion functions between pubkey/uint160/address in base58.h, have a fully fledged class CBitcoinAddress (CAddress was already taken) to represent addresses.
* get rid of mapPubKeysPieter Wuille2011-07-171-2/+1
| | | | | Make CKeyStore's interface work on uint160's instead of pubkeys, so no separate global mapPubKeys is necessary anymore.
* fix warnings: expression result unused [-Wunused-value]Giel van Schijndel2011-07-131-1/+1
| | | | | | | | | | | | | | | In the assert()s take advantage of the fact that string constants ("string") are effectively of type 'const char []', which when used in an expression yield a non-NULL pointer. An assertion that should always fail can thus be formulated as: assert(!"fail); An assertion where a text message should be added to the expression can be written as such: assert("message" && expression); Signed-off-by: Giel van Schijndel <[email protected]>
* CWallet classPieter Wuille2011-06-151-4/+3
| | | | | | | | | | | | * A new class CKeyStore manages private keys, and script.cpp depends on access to CKeyStore. * A new class CWallet extends CKeyStore, and contains all former wallet-specific globals; CWallet depends on script.cpp, not the other way around. * Wallet-specific functions in CTransaction/CTxIn/CTxOut (GetDebit, GetCredit, GetChange, IsMine, IsFromMe), are moved to CWallet, taking their former 'this' argument as an explicit parameter * CWalletTx objects know which CWallet they belong to, for convenience, so they have their own direct (and caching) GetDebit/... functions. * Some code was moved from CWalletDB to CWallet, such as handling of reserve keys. * Main.cpp keeps a set of all 'registered' wallets, which should be informed about updates to the block chain, and does not have any notion about any 'main' wallet. Function in main.cpp that require a wallet (such as GenerateCoins), take an explicit CWallet* argument. * The actual CWallet instance used by the application is defined in init.cpp as "CWallet* pwalletMain". rpc.cpp and ui.cpp use this variable. * Functions in main.cpp and db.cpp that are not used by other modules are marked static. * The code for handling the 'submitorder' message is removed, as it not really compatible with the idea that a node is independent from the wallet(s) connected to it, and obsolete anyway.
* move wallet code to separate filePieter Wuille2011-06-151-0/+1
| | | | | | This introduces two new source files, keystore.cpp and wallet.cpp with corresponding headers. Code is moved from main and db, in a preparation for a follow-up commit which introduces the classes CWallet and CKeyStore.
* make bitcoin include files more modularWladimir J. van der Laan2011-05-151-22/+31
|
* directory re-organization (keeps the old build system)Jaromil2011-04-231-0/+709
there is no internal modification of any file in this commit files are moved into directories according to established standards in sourcecode distribution; these directories contain: src - Files that are used in constructing the executable binaries, but are not installed. doc - Files in HTML and text format that document usage, quirks of the implementation, and contributor checklists. locale - Files that contain human language translation of strings used in the program contrib - Files contributed from distributions or other third party implementing scripts and auxiliary programs