aboutsummaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
...
* | | | | | | | | | LevelDB block and coin databasesPieter Wuille2012-10-2014-339/+569
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Split off CBlockTreeDB and CCoinsViewDB into txdb-*.{cpp,h} files, implemented by either LevelDB or BDB. Based on code from earlier commits by Mike Hearn in his leveldb branch.
* | | | | | | | | | Flush and sync block dataPieter Wuille2012-10-201-8/+21
| | | | | | | | | |
* | | | | | | | | | Use singleton block tree database instancePieter Wuille2012-10-206-59/+61
| | | | | | | | | |
* | | | | | | | | | Prepare database format for multi-stage block processingPieter Wuille2012-10-204-75/+197
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit adds a status field and a transaction counter to the block indexes.
* | | | | | | | | | Automatically reorganize at startup to best known blockPieter Wuille2012-10-202-1/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Given that the block tree database (chain.dat) and the active chain database (coins.dat) are entirely separate now, it becomes legal to swap one with another instance without affecting the other. This commit introduces a check in the startup code that detects the presence of a better chain in chain.dat that has not been activated yet, and does so efficiently (in batch, while reusing the blk???.dat files).
* | | | | | | | | | Direct CCoins referencesPieter Wuille2012-10-203-61/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To prevent excessive copying of CCoins in and out of the CCoinsView implementations, introduce a GetCoins() function in CCoinsViewCache with returns a direct reference. The block validation and connection logic is updated to require caching CCoinsViews, and exploits the GetCoins() function heavily.
* | | | | | | | | | Transaction hash cachingPieter Wuille2012-10-205-27/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use CBlock's vMerkleTree to cache transaction hashes, and pass them along as argument in more function calls. During initial block download, this results in every transaction's hash to be only computed once.
* | | | | | | | | | Batch block connection during IBDPieter Wuille2012-10-2010-169/+181
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | During the initial block download (or -loadblock), delay connection of new blocks a bit, and perform them in a single action. This reduces the load on the database engine, as subsequent blocks often update an earlier block's transaction already.
* | | | | | | | | | UltraprunePieter Wuille2012-10-2015-1124/+887
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | | | | | | | Pre-allocate block and undo files in chunksPieter Wuille2012-10-204-9/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce a AllocateFileRange() function in util, which wipes or at least allocates a given range of a file. It can be overriden by more efficient OS-dependent versions if necessary. Block and undo files are now allocated in chunks of 16 and 1 MiB, respectively.
* | | | | | | | | | Multiple blocks per filePieter Wuille2012-10-204-102/+265
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change the block storage layer again, this time with multiple files per block, but tracked by txindex.dat database entries. The file format is exactly the same as the earlier blk00001.dat, but with smaller files (128 MiB for now). The database entries track how many bytes each block file already uses, how many blocks are in it, which range of heights is present and which range of dates.
* | | | | | | | | | Preliminary undo file creationPieter Wuille2012-10-202-0/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Create files (one per block) with undo information for the transactions in it.
* | | | | | | | | | One file per blockPieter Wuille2012-10-203-124/+155
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Refactor of the block storage code, which now stores one file per block. This will allow easier pruning, as blocks can be removed individually.
* | | | | | | | | | Add CTxUndo: transaction undo informationPieter Wuille2012-10-201-3/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The CTxUndo class encapsulates data necessary to undo the effects of a transaction on the txout set, namely the previous outputs consumed by it (script + amount), and potentially transaction meta-data when it is spent entirely.
* | | | | | | | | | Add CCoins: pruned list of transaction outputsPieter Wuille2012-10-201-1/+233
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The CCoins class represents a pruned set of transaction outputs from a given transaction. It only retains information about its height in the block chain, whether it was a coinbase transaction, and its unspent outputs (script + amount). It has a custom serializer that has very low redundancy.
* | | | | | | | | | Compact serialization for amountsPieter Wuille2012-10-203-3/+130
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Special serializer/deserializer for amount values. It is optimized for values which have few non-zero digits in decimal representation. Most amounts currently in the txout set take only 1 or 2 bytes to represent.
* | | | | | | | | | Compact serialization for scriptsPieter Wuille2012-10-205-4/+213
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | | | | | | | Compact serialization for variable-length integersPieter Wuille2012-10-202-1/+138
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Variable-length integers: bytes are a MSB base-128 encoding of the number. The high bit in each byte signifies whether another digit follows. To make the encoding is one-to-one, one is subtracted from all but the last digit. Thus, the byte sequence a[] with length len, where all but the last byte has bit 128 set, encodes the number: (a[len-1] & 0x7F) + sum(i=1..len-1, 128^i*((a[len-i-1] & 0x7F)+1)) Properties: * Very small (0-127: 1 byte, 128-16511: 2 bytes, 16512-2113663: 3 bytes) * Every integer has exactly one encoding * Encoding does not depend on size of original integer type
* | | | | | | | | | LevelDB gluePieter Wuille2012-10-206-5/+211
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Database-independent glue for supporting LevelDB databases. Based on code from earlier commits by Mike Hearn in his leveldb branch.
* | | | | | | | | | Makefile integration of LevelDBPieter Wuille2012-10-204-0/+49
| | | | | | | | | |
* | | | | | | | | | Backport Win32 LevelDB env from C++0x to C++Pieter Wuille2012-10-204-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since the gitian mingw compiler doesn't support C++0x yet.
* | | | | | | | | | Disable libsnappy detection in LevelDBPieter Wuille2012-10-201-11/+0
| | | | | | | | | |
* | | | | | | | | | Leveldb Windows port by Edouard Alligand, adapted for MingW by me.justmoon2012-10-208-33/+1106
| | | | | | | | | |
* | | | | | | | | | Import LevelDB 1.5, it will be used for the transaction database.Mike Hearn2012-10-20129-0/+25478
| | | | | | | | | |
* | | | | | | | | | Merge pull request #1880 from sipa/threadimportJeff Garzik2012-10-207-27/+70
|\ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | Move external block import to separate thread
| * | | | | | | | | | Move external block import to separate threadPieter Wuille2012-10-207-27/+70
| |/ / / / / / / / /
* | | | | | | | | | Merge pull request #1742 from sipa/canonicalJeff Garzik2012-10-2012-62/+245
|\ \ \ \ \ \ \ \ \ \ | |/ / / / / / / / / |/| | | | | | | | | Check for canonical public keys and signatures
| * | | | | | | | | Check for canonical public keys and signaturesPieter Wuille2012-09-2112-62/+245
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Only enabled inside tests for now.
* | | | | | | | | | Revert "Merge pull request #1931 from laanwj/2012_10_newicons"Wladimir J. van der Laan2012-10-146-0/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 199d88cf901866f3c2fa2b5bd83074d11ebad02c, reversing changes made to 65bc1573e73791c26472c3177732b7d167aa5bec. License is worse instead of better. Will only accept public domain and MIT-licensed icons from now on.
* | | | | | | | | | Changed connect?_16.png to non-GPL one and changed the assets attribution.xanatos2012-10-145-0/+0
| | | | | | | | | |
* | | | | | | | | | Changed the spinner to a non-GPL one, added instructions on how to ↵xanatos2012-10-141-0/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | regenerate it, changed the assets attribution, removed old spinner + old spinner's sources.
* | | | | | | | | | Bitcoin-Qt: intregrate current translations from TransifexPhilip Kaufmann2012-10-1234-3892/+3886
| | | | | | | | | |
* | | | | | | | | | Bitcoin-Qt: update english translation master filePhilip Kaufmann2012-10-121-16/+16
| | | | | | | | | |
* | | | | | | | | | Fix a use-after-free problem in initialization (#1920)Wladimir J. van der Laan2012-10-121-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Don't store the result of c_str(). Luckily, this only affects logging, though it could crash or leak sensitive data to the log in rare cases.
* | | | | | | | | | Merge pull request #1879 from sipa/fdatasyncWladimir J. van der Laan2012-10-111-0/+4
|\ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | Use fdatasync instead of fsync on supported platforms
| * | | | | | | | | | Use fdatasync instead of fsync on supported platformsPieter Wuille2012-10-071-0/+4
| | | | | | | | | | |
* | | | | | | | | | | Merge pull request #1913 from sipa/noi2pWladimir J. van der Laan2012-10-112-41/+6
|\ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | Remove I2P support from netbase
| * | | | | | | | | | | Remove I2P support from netbasePieter Wuille2012-10-072-41/+6
| |/ / / / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I2P apparently needs 256 bits to store a fully routable address. Garlicat requires a centralized lookup service to map the 80-bit addresses to fully routable ones (as far as I understood), so that's not really usable in our situation. To support I2P routing and peer exchange for it, another solution is needed. This will most likely imply a network protocol change, and extension of the 'addr' message.
* | | | | | | | | | | Merge pull request #1900 from Diapolo/optionsmodel_gettersWladimir J. van der Laan2012-10-112-24/+4
|\ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | move most explicit getters in optionsmodel to header
| * | | | | | | | | | | move most explicit getters in optionsmodel to headerPhilip Kaufmann2012-10-022-24/+4
| | |_|_|_|/ / / / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - is more consistent and saves quite some lines of code
* | | | | | | | | | | Merge pull request #1911 from Diapolo/fix_signed_unsignedWladimir J. van der Laan2012-10-112-2/+2
|\ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | fix wrong (signed/unsigned) printf format specifier in bitcoinrpc.cpp
| * | | | | | | | | | | fix wrong (signed/unsigned) printf format specifier in bitcoinrpc.cppPhilip Kaufmann2012-10-052-2/+2
| | |_|_|/ / / / / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - also includes the required bitcoinstrings.cpp update
* | | | | | | | | | | Merge pull request #1901 from laanwj/2012_10_remove_strlcpyWladimir J. van der Laan2012-10-115-124/+30
|\ \ \ \ \ \ \ \ \ \ \ | |_|_|_|_|_|_|/ / / / |/| | | | | | | | | | get rid of strlcpy.h
| * | | | | | | | | | get rid of strlcpy.hWladimir J. van der Laan2012-10-075-124/+30
| | |_|/ / / / / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Don't use hand-rolled string manipulation routine with a fixed buffer in the bitcoin core, instead make use of c++ strings and boost.
* | | | | | | | | | Bump versions for 0.7.1 releaseGavin Andresen2012-10-091-2/+2
| | | | | | | | | |
* | | | | | | | | | Fix bad merge, pszDataDir duplicationGavin Andresen2012-10-091-1/+0
| | | | | | | | | |
* | | | | | | | | | Merge branch 'wallet_exceptions' of github.com:gavinandresen/bitcoin-gitGavin Andresen2012-10-098-204/+521
|\ \ \ \ \ \ \ \ \ \
| * | | | | | | | | | Don't try to verify a non-existent wallet.datGavin Andresen2012-10-081-10/+13
| | | | | | | | | | |
| * | | | | | | | | | Handle corrupt wallets gracefully.Gavin Andresen2012-10-088-213/+518
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Corrupt wallets used to cause a DB_RUNRECOVERY uncaught exception and a crash. This commit does three things: 1) Runs a BDB verify early in the startup process, and if there is a low-level problem with the database: + Moves the bad wallet.dat to wallet.timestamp.bak + Runs a 'salvage' operation to get key/value pairs, and writes them to a new wallet.dat + Continues with startup. 2) Much more tolerant of serialization errors. All errors in deserialization are reported by tolerated EXCEPT for errors related to reading keypairs or master key records-- those are reported and then shut down, so the user can get help (or recover from a backup). 3) Adds a new -salvagewallet option, which: + Moves the wallet.dat to wallet.timestamp.bak + extracts ONLY keypairs and master keys into a new wallet.dat + soft-sets -rescan, to recreate transaction history This was tested by randomly corrupting testnet wallets using a little python script I wrote (https://gist.github.com/3812689)
| * | | | | | | | | | Handle incompatible BDB environmentsGavin Andresen2012-10-082-15/+19
| | |_|_|_|/ / / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before, opening a -datadir that was created with a new version of Berkeley DB would result in an un-caught DB_RUNRECOVERY exception. After these changes, the error is caught and the user is told that there is a problem and is told how to try to recover from it.