aboutsummaryrefslogtreecommitdiff
path: root/src/main.h
AgeCommit message (Collapse)Author
2012-10-20Add gettxout and gettxoutsetinfo RPCsPieter Wuille
2012-10-20LevelDB block and coin databasesPieter Wuille
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.
2012-10-20Use singleton block tree database instancePieter Wuille
2012-10-20Prepare database format for multi-stage block processingPieter Wuille
This commit adds a status field and a transaction counter to the block indexes.
2012-10-20Direct CCoins referencesPieter Wuille
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.
2012-10-20Transaction hash cachingPieter Wuille
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.
2012-10-20Batch block connection during IBDPieter Wuille
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.
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-20Move external block import to separate threadPieter Wuille
2012-10-01fix -Wformat warnings all over the sourcePhilip Kaufmann
2012-09-21Merge pull request #1793 from Diapolo/fix_signed_unsigned_strprintfWladimir J. van der Laan
fix signed/unsigned in strprintf and CNetAddr::GetByte()
2012-09-18Trim trailing whitespace for src/*.{h,cpp}Jeff Garzik
2012-09-12fix signed/unsigned in strprintf and CNetAddr::GetByte()Philip Kaufmann
- I checked every occurance of strprintf() in the code and used %u, where unsigned vars are used - the change to GetByte() was made, as ip is an unsigned char
2012-09-09Cosmetic: move CTransaction::GetMinFee out of header fileJeff Garzik
2012-09-05Merge branch 'testnet_alert' of git://github.com/gavinandresen/bitcoin-gitGavin Andresen
2012-08-28Refactor: move alert code from main to alert.cpp/hGavin Andresen
2012-08-28Changed nprev->pprevxanatos
It should be pprev, because the next one is pnext, and it's printing the memory address of the CBlockIndex (so pSomething).
2012-08-26Alert system DoS preventionGavin Andresen
This fixes two alert system vulnerabilities found by Sergio Lerner; you could send peers unlimited numbers of invalid alert message to try to either fill up their debug.log with messages and/or keep their CPU busy checking signatures. Fixed by disconnecting/banning peers if they send 10 or more bad (invalid/expired/cancelled) alerts.
2012-08-20Block height in coinbase as a new block ruleGavin Andresen
"Version 2" blocks are blocks that have nVersion=2 and have the block height as the first item in their coinbase. Block-height-in-the-coinbase is strictly enforced when version=2 blocks are a supermajority in the block chain (750 of the last 1,000 blocks on main net, 51 of 100 for testnet). This does not affect old clients/miners at all, which will continue producing nVersion=1 blocks, and which will continue to be valid.
2012-08-20Merge pull request #1641 from jgarzik/mempoolJeff Garzik
Add 'mempool' P2P command, and extend 'getdata' behavior
2012-08-01Merge pull request #1612 from luke-jr/opti_getblkhashGregory Maxwell
Optimize JSON-RPC getblockhash
2012-08-01Optimize JSON-RPC getblockhashLuke Dashjr
- If the height is in the first half, start at the genesis block and go up, rather than at the top - Cache the last lookup and use it as a reference point if it's close to the next request, to make linear lookups always fast
2012-08-01Bugfix: Use standard BTC unit in commentsLuke Dashjr
2012-07-31Add 'mempool' P2P command, and extend 'getdata' behaviorJeff Garzik
to permit downloading of mempool transactions from the remote peer.
2012-07-12Tests for CreateNewBlockLuke Dashjr
2012-07-11Merge branch 'checknewblock_0.6.0' into checknewblockLuke Dashjr
Conflicts: src/main.cpp
2012-07-06Treat non-version-1 transactions as non-standardGavin Andresen
Adds CBlock::CURRENT_VERSION and CTransaction::CURRENT_VERSION constants, and makes non-CURRENT_VERSION transactions nonstandard. This will help make future upgrades smoother.
2012-07-04CTxMemPool: eliminate redundant lock, GetHash() callJeff Garzik
::addUnchecked()'s only caller already takes the necessary lock, and has already calculated the TX's hash.
2012-06-22RPC: add 'getrawmempool', listing all transaction ids in memory poolJeff Garzik
2012-05-27CreateNewBlock: Check that the produced CBlock is acceptable (except for ↵Luke Dashjr
proof-of-work and merkletree, since those need to be provided later) This throws an exception from CreateNewBlock otherwise, which is not safe without #1245!
2012-05-23JSON-RPC: Add 'sendrawtx' op, for sending pre-built TX's to networkJeff Garzik
2012-05-22Prevent crashes due to missing or corrupted blk????.dat recordsJeff Garzik
In LoadExternalBlockFile(), errors are already caught... silently. Add a warning message, even though we do not abort the program due to load error.
2012-05-20Merge pull request #1354 from fanquake/masterPieter Wuille
Update Header Licenses
2012-05-20Fine-grained UI updatesWladimir J. van der Laan
Gets rid of `MainFrameRepaint` in favor of specific update functions that tell the UI exactly what changed. This improves the efficiency of various handlers. Also fixes problems with mined transactions not showing up until restart. The following notifications were added: - `NotifyBlocksChanged`: Block chain changed - `NotifyKeyStoreStatusChanged`: Wallet status (encrypted, locked) changed. - `NotifyAddressBookChanged`: Address book entry changed. - `NotifyTransactionChanged`: Wallet transaction added, removed or updated. - `NotifyNumConnectionsChanged`: Number of connections changed. - `NotifyAlertChanged`: New, updated or cancelled alert. As this finally makes it possible for the UI to know when a new alert arrived, it can be shown as OS notification. These notifications could also be useful for RPC clients. However, currently, they are ignored in bitcoind (in noui.cpp). Also brings back polling with timer for numBlocks in ClientModel. This value updates so frequently during initial download that the number of signals clogs the UI thread and causes heavy CPU usage. And after initial block download, the value changes so rarely that a delay of half a second until the UI updates is unnoticable.
2012-05-19Merge pull request #1296 from Diapolo/CheckDiskSpaceGavin Andresen
make CheckDiskSpace() use 50 * 1024 * 1024 Bytes
2012-05-18Update License in File HeadersFordy
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.
2012-05-17fix RenameOver() and FileCommit() functions, to not generate compilation errorsPhilip Kaufmann
2012-05-17Merge pull request #1316 from jgarzik/dead-codeJeff Garzik
Remove dead code: CTxDB::EraseBlockIndex(), CBlockIndex::EraseBlockFromDisk()
2012-05-16Add new utility functions FileCommit(), RenameOver()Jeff Garzik
2012-05-15Remove dead code: CTxDB::EraseBlockIndex(), CBlockIndex::EraseBlockFromDisk()Jeff Garzik
2012-05-14make CheckDiskSpace() use a global static const uint64 for checking required ↵Philip Kaufmann
disk space and remove 2 ugly spaces from a message string
2012-05-11Split synchronization mechanisms from util.{h,cpp}Pieter Wuille