aboutsummaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2012-10-20UltraprunePieter Wuille
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.
2012-10-20Pre-allocate block and undo files in chunksPieter Wuille
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.
2012-10-20Multiple blocks per filePieter Wuille
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.
2012-10-20Preliminary undo file creationPieter Wuille
Create files (one per block) with undo information for the transactions in it.
2012-10-20One file per blockPieter Wuille
Refactor of the block storage code, which now stores one file per block. This will allow easier pruning, as blocks can be removed individually.
2012-10-20Add CTxUndo: transaction undo informationPieter Wuille
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.
2012-10-20Add CCoins: pruned list of transaction outputsPieter Wuille
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.
2012-10-20Compact serialization for amountsPieter Wuille
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.
2012-10-20Compact serialization for scriptsPieter Wuille
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.
2012-10-20Compact serialization for variable-length integersPieter Wuille
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
2012-10-20LevelDB gluePieter Wuille
Database-independent glue for supporting LevelDB databases. Based on code from earlier commits by Mike Hearn in his leveldb branch.
2012-10-20Makefile integration of LevelDBPieter Wuille
2012-10-20Backport Win32 LevelDB env from C++0x to C++Pieter Wuille
Since the gitian mingw compiler doesn't support C++0x yet.
2012-10-20Disable libsnappy detection in LevelDBPieter Wuille
2012-10-20Leveldb Windows port by Edouard Alligand, adapted for MingW by me.justmoon
2012-10-20Import LevelDB 1.5, it will be used for the transaction database.Mike Hearn
2012-10-20Merge pull request #1880 from sipa/threadimportJeff Garzik
Move external block import to separate thread
2012-10-20Merge pull request #1742 from sipa/canonicalJeff Garzik
Check for canonical public keys and signatures
2012-10-20Move external block import to separate threadPieter Wuille
2012-10-14Revert "Merge pull request #1931 from laanwj/2012_10_newicons"Wladimir J. van der Laan
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.
2012-10-14Changed connect?_16.png to non-GPL one and changed the assets attribution.xanatos
2012-10-14Changed the spinner to a non-GPL one, added instructions on how to ↵xanatos
regenerate it, changed the assets attribution, removed old spinner + old spinner's sources.
2012-10-12Bitcoin-Qt: intregrate current translations from TransifexPhilip Kaufmann
2012-10-12Bitcoin-Qt: update english translation master filePhilip Kaufmann
2012-10-12Fix a use-after-free problem in initialization (#1920)Wladimir J. van der Laan
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.
2012-10-11Merge pull request #1879 from sipa/fdatasyncWladimir J. van der Laan
Use fdatasync instead of fsync on supported platforms
2012-10-11Merge pull request #1913 from sipa/noi2pWladimir J. van der Laan
Remove I2P support from netbase
2012-10-11Merge pull request #1900 from Diapolo/optionsmodel_gettersWladimir J. van der Laan
move most explicit getters in optionsmodel to header
2012-10-11Merge pull request #1911 from Diapolo/fix_signed_unsignedWladimir J. van der Laan
fix wrong (signed/unsigned) printf format specifier in bitcoinrpc.cpp
2012-10-11Merge pull request #1901 from laanwj/2012_10_remove_strlcpyWladimir J. van der Laan
get rid of strlcpy.h
2012-10-09Bump versions for 0.7.1 releaseGavin Andresen
2012-10-09Fix bad merge, pszDataDir duplicationGavin Andresen
2012-10-09Merge branch 'wallet_exceptions' of github.com:gavinandresen/bitcoin-gitGavin Andresen
2012-10-09Merge branch 'crash_at_exit' of github.com:gavinandresen/bitcoin-gitGavin Andresen
2012-10-08Merge pull request #1915 from Diapolo/Qt5_compat_leftoverWladimir J. van der Laan
change Q_WS_MAC -> Q_OS_MAC (Qt5 compatibility)
2012-10-08Merge pull request #1834 from jgarzik/kickblocksJeff Garzik
P2P: Do not request blocks from peers with fewer blocks than us
2012-10-08Revert "Send 'mempool' P2P command at the start of each P2P session"Jeff Garzik
Fat-fingered on github, and merged this too early. This reverts commit 22f9b069035c9ba0416a62714db167eea5ba762f.
2012-10-08Merge pull request #1833 from jgarzik/mempool-queryJeff Garzik
Send 'mempool' P2P command at the start of each P2P session
2012-10-08Don't try to verify a non-existent wallet.datGavin Andresen
2012-10-08Handle corrupt wallets gracefully.Gavin Andresen
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)
2012-10-08Handle incompatible BDB environmentsGavin Andresen
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.
2012-10-08Merge branch 'BDB_DOWNGRADE'Gavin Andresen
2012-10-08Handle incompatible BDB environmentsGavin Andresen
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.
2012-10-07change Q_WS_MAC -> Q_OS_MAC (Qt5 compatibility)Philip Kaufmann
- I missed that one in my former pull
2012-10-07Merge pull request #1859 from Diapolo/proxy_locksPieter Wuille
add LOCK() for proxy related data-structures
2012-10-07Use fdatasync instead of fsync on supported platformsPieter Wuille
2012-10-07Remove I2P support from netbasePieter Wuille
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.
2012-10-07get rid of strlcpy.hWladimir J. van der Laan
Don't use hand-rolled string manipulation routine with a fixed buffer in the bitcoin core, instead make use of c++ strings and boost.
2012-10-05fix wrong (signed/unsigned) printf format specifier in bitcoinrpc.cppPhilip Kaufmann
- also includes the required bitcoinstrings.cpp update
2012-10-05Merge pull request #1906 from laanwj/2012_10_help_stdoutWladimir J. van der Laan
Send --help message to stdout i.s.o stderr