aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
AgeCommit message (Collapse)Author
2015-06-15Use best header chain timestamps to detect partitioningGavin Andresen
The partition checking code was using chainActive timestamps to detect partitioning; with headers-first syncing, it should use (and with this pull request, does use) pIndexBestHeader timestamps. Fixes issue #6251 Github-Pull: #6256 Rebased-From: 65b94545036ae6e38e79e9c7166a3ba1ddb83f66
2015-06-15Add option `-alerts` to opt out of alert systemWladimir J. van der Laan
Make it possible to opt-out of the centralized alert system by providing an option `-noalerts` or `-alerts=0`. The default remains unchanged. This is a gentler form of #6260, in which I went a bit overboard by removing the alert system completely. I intend to add this to the GUI options in another pull after this. Github-Pull: #6274 Rebased-From: 02a6702a82a5b00e0e0351041dd3267308b7f319
2015-06-11Prune: Support noncontiguous block filesAdam Weiss
In some corner cases, it may be possible for recent blocks to end up in the same block file as much older blocks. Previously, the pruning code would stop looking for files to remove upon first encountering a file containing a block that cannot be pruned, now it will keep looking for candidate files until the target is met and all other criteria are satisfied. This can result in a noncontiguous set of block files (by number) on disk, which is fine except for during some reindex corner cases, so make reindex preparation smarter such that we keep the data we can actually use and throw away the rest. This allows pruning to work correctly while downloading any blocks needed during the reindex. Rebased-From: c257a8c9a6397eee40734b235a4fdcb8045aec91 Github-Pull: #6221
2015-06-10Fix removing of orphan transactionsAlex Morcos
We don't want to erase orphans that still have missing inputs, they should still be tracked as orphans. Also, the transaction thats being accepted can't be an orphan otherwise it would have previously been accepted, so doesn't need to be added to the erase queue. Github-Pull: #5985 Rebased-From: 14d4eef79931318cb5968f9154cf458d9f8d27fa
2015-06-03Be stricter in processing unrequested blocksSuhas Daftuar
AcceptBlock will no longer process an unrequested block, unless it has not been previously processed and has more work than chainActive.Tip() Github-Pull: #5875 Rebased-From: 9be0e6837b878f72bd087ce32b7a2f2ffb2fd544
2015-06-02Ignore getheaders requests when not synced.Suhas Daftuar
Rebased-From: a1ba0778dd3c784046dea334e5d39f37eca264f7 Github-Pull: #6172
2015-06-01Fix off-by-one error w/ nLockTime in the walletPeter Todd
Previously due to an off-by-one error the wallet ignored nLockTime-by-height transactions that would be valid in the next block even though they are accepted into the mempool. The transactions wouldn't show up until confirmed, nor would they be included in the unconfirmed balance. Similar to the mempool behavior fix in 665bdd3b, the wallet code was calling IsFinalTx() directly without taking into account the fact that doing so tells you if the transaction could have been mined in the *current* block, rather than the next block. To fix this we strip IsFinalTx() of non-consensus-critical functionality, removing the default arguments, and add CheckFinalTx() to check if a transaction will be final in the next block. Github-Pull: #6183 Rebased-From: 28bf06236d3b385e95fe26a7a742395b30efd6ee
2015-06-01Merge pull request #6195Wladimir J. van der Laan
8273793 Eliminate compiler warning due to unused variable (Suhas Daftuar)
2015-05-27Eliminate compiler warning due to unused variableSuhas Daftuar
2015-05-27Chainparams: Explicit CMessageHeader::MessageStartChars to functions in main:Jorge Timón
-UndoWriteToDisk -WriteBlockToDisk
2015-05-27Merge pull request #5669Wladimir J. van der Laan
da29ecb Consensus: MOVEONLY: Move CValidationState from main consensus/validation (jtimon) 27afcd8 Consensus: Refactor: Decouple CValidationState from main::AbortNode() (Cory Fields)
2015-05-26Merge pull request #5976Wladimir J. van der Laan
8ba7f84 Reduce download timeouts as blocks arrive (Suhas Daftuar)
2015-05-26Merge pull request #5947Wladimir J. van der Laan
36cba8f Alert if it is very likely we are getting a bad chain (Gavin Andresen)
2015-05-19Merge pull request #5996Wladimir J. van der Laan
935bd0a Chainparams: Refactor: Decouple main::GetBlockValue() from Params() [renamed GetBlockSubsidy] (Jorge Timón)
2015-05-15Chainparams: Refactor: Decouple main::GetBlockValue() from Params() [renamed ↵Jorge Timón
GetBlockSubsidy] Remove redundant getter CChainParams::SubsidyHalvingInterval()
2015-05-15Consensus: MOVEONLY: Move CValidationState from main consensus/validationjtimon
2015-05-15Consensus: Refactor: Decouple CValidationState from main::AbortNode()Cory Fields
2015-05-15Fix for clearing fCheckForPruningAlex Morcos
Previously this was cleared only after UnlinkPrunedFiles, but it should really be cleared after FindFilesToPrune, regardless of whether there are any files to be pruned.
2015-05-15Merge pull request #5968Wladimir J. van der Laan
51aa249 Chainparams: Refactor: Decouple IsSuperMajority from Params() (Jorge Timón)
2015-05-15Merge pull request #6102Wladimir J. van der Laan
86a5f4b Relocate calls to CheckDiskSpace (Alex Morcos) 67708ac Write block index more frequently than cache flushes (Pieter Wuille) b3ed423 Cache tweak and logging improvements (Pieter Wuille) fc684ad Use accurate memory for flushing decisions (Pieter Wuille) 046392d Keep track of memory usage in CCoinsViewCache (Pieter Wuille) 540629c Add memusage.h (Pieter Wuille)
2015-05-14Alert if it is very likely we are getting a bad chainGavin Andresen
Create a monitoring task that counts how many blocks have been found in the last four hours. If very few or too many have been found, an alert is triggered. "Very few" and "too many" are set based on a false positive rate of once every fifty years of constant running with constant hashing power, which works out to getting 5 or fewer or 48 or more blocks in four hours (instead of the average of 24). Only one alert per day is triggered, so if you get disconnected from the network (or are being Sybil'ed) -alertnotify will be triggered after 3.5 hours but you won't get another -alertnotify for 24 hours. Tested with a new unit test and by running on the main network with -debug=partitioncheck Run test/test_bitcoin --log_level=message to see the alert messages: WARNING: check your network connection, 3 blocks received in the last 4 hours (24 expected) WARNING: abnormally high number of blocks generated, 60 blocks received in the last 4 hours (24 expected) The -debug=partitioncheck debug.log messages look like: ThreadPartitionCheck : Found 22 blocks in the last 4 hours ThreadPartitionCheck : likelihood: 0.0777702
2015-05-13Fix incorrect variable name in FindFilesToPruneSuhas Daftuar
2015-05-13Merge pull request #5159Wladimir J. van der Laan
b649e03 Create new BlockPolicyEstimator for fee estimates (Alex Morcos)
2015-05-13Create new BlockPolicyEstimator for fee estimatesAlex Morcos
This class groups transactions that have been confirmed in blocks into buckets, based on either their fee or their priority. Then for each bucket, the class calculates what percentage of the transactions were confirmed within various numbers of blocks. It does this by keeping an exponentially decaying moving history for each bucket and confirm block count of the percentage of transactions in that bucket that were confirmed within that number of blocks. -Eliminate txs which didn't have all inputs available at entry from fee/pri calcs -Add dynamic breakpoints and tracking of confirmation delays in mempool transactions -Remove old CMinerPolicyEstimator and CBlockAverage code -New smartfees.py -Pass a flag to the estimation code, using IsInitialBlockDownload as a proxy for when we are still catching up and we shouldn't be counting how many blocks it takes for transactions to be included. -Add a policyestimator unit test
2015-05-12Relocate calls to CheckDiskSpaceAlex Morcos
Make sure we're checking disk space for block index writes and allow for pruning to happen before chainstate writes.
2015-05-11Write block index more frequently than cache flushesPieter Wuille
2015-05-11Cache tweak and logging improvementsPieter Wuille
2015-05-11Use accurate memory for flushing decisionsPieter Wuille
2015-05-06Chainparams: Refactor: Decouple IsSuperMajority from Params()Jorge Timón
2015-05-06Merge pull request #6055Wladimir J. van der Laan
a8cdaf5 checkpoints: move the checkpoints enable boolean into main (Cory Fields) 11982d3 checkpoints: Decouple checkpoints from Params (Cory Fields) 6996823 checkpoints: make checkpoints a member of CChainParams (Cory Fields) 9f13a10 checkpoints: store mapCheckpoints in CCheckpointData rather than a pointer (Cory Fields)
2015-05-04Merge pull request #6085Wladimir J. van der Laan
b05a89b Non-grammatical language improvements (Luke Dashjr) 7e6d23b Bugfix: Grammar fixes (Corinne Dashjr)
2015-05-02Non-grammatical language improvementsLuke Dashjr
2015-05-01Bugfix: Grammar fixesCorinne Dashjr
2015-04-30checkpoints: move the checkpoints enable boolean into mainCory Fields
This pertains to app-state, so it doesn't make sense to handle inside the checkpoint functions.
2015-04-30checkpoints: Decouple checkpoints from ParamsCory Fields
Pass checkpoint data in as necessary
2015-04-30Replace mruset setAddrKnown with CRollingBloomFilter addrKnownGavin Andresen
Use a probabilistic bloom filter to keep track of which addresses we think we have given our peers, instead of a list. This uses much less memory, at the cost of sometimes failing to relay an address to a peer-- worst case if the bloom filter happens to be as full as it gets, 1-in-1,000. Measured memory usage of a full mruset setAddrKnown: 650Kbytes Constant memory usage of CRollingBloomFilter addrKnown: 37Kbytes. This will also help heap fragmentation, because the 37K of storage is allocated when a CNode is created (when a connection to a peer is established) and then there is no per-item-remembered memory allocation. I plan on testing by restarting a full node with an empty peers.dat, running a while with -debug=addrman and -debug=net, and making sure that the 'addr' message traffic out is reasonable. (suggestions for better tests welcome)
2015-04-28Merge pull request #5918Pieter Wuille
f7303f9 Use equivalent PoW for non-main-chain requests (Pieter Wuille)
2015-04-28Merge pull request #5662Wladimir J. van der Laan
00dcaf4 Change download logic to allow calling getheaders/getdata on inbound peers (Suhas Daftuar)
2015-04-22Add block pruning functionalitymrbandrews
This adds a -prune=N option to bitcoind, which if set to N>0 will enable block file pruning. When pruning is enabled, block and undo files will be deleted to try to keep total space used by those files to below the prune target (N, in MB) specified by the user, subject to some constraints: - The last 288 blocks on the main chain are always kept (MIN_BLOCKS_TO_KEEP), - N must be at least 550MB (chosen as a value for the target that could reasonably be met, with some assumptions about block sizes, orphan rates, etc; see comment in main.h), - No blocks are pruned until chainActive is at least 100,000 blocks long (on mainnet; defined separately for mainnet, testnet, and regtest in chainparams as nPruneAfterHeight). This unsets NODE_NETWORK if pruning is enabled. Also included is an RPC test for pruning (pruning.py). Thanks to @rdponticelli for earlier work on this feature; this is based in part off that work.
2015-04-22Use equivalent PoW for non-main-chain requestsPieter Wuille
2015-04-20Merge pull request #6010Wladimir J. van der Laan
c1ecee8 Set nSequenceId when a block is fully linked (Suhas Daftuar)
2015-04-20Removed '()' where used without contents insideNicolas Benoit
This additional patch removes '()' from current function name in LogPrintf output.
2015-04-20Replaced current function names with __func__ in LogPrintf() calls.Nicolas Benoit
2015-04-16Merge pull request #6012Wladimir J. van der Laan
0421c18 Fix CheckBlockIndex for reindex. (mrbandrews)
2015-04-15Reduce download timeouts as blocks arriveSuhas Daftuar
Compare the block download timeout to what the timeout would be if calculated based on current time and current value of nQueuedValidatedHeaders, but ignoring other in-flight blocks from the same peer. If the calculation based on present conditions is shorter, then set that to be the time after which we disconnect the peer for not delivering this block.
2015-04-15Merge pull request #5997Wladimir J. van der Laan
4e38217 Chainparams: Refactor: Remove redundant HashGenesisBlock() getter (Jorge Timón)
2015-04-14Fix CheckBlockIndex for reindex.mrbandrews
Some tests in CheckBlockIndex require chainActive.Tip(), but when reindexing, chainActive has not been set on the first call to CheckBlockIndex. reindex.py starts a node, mines 3 blocks, stops, and reindexes with CheckBlockIndex enabled.
2015-04-14Set nSequenceId when a block is fully linkedSuhas Daftuar
Also adds a test to CheckBlockIndex
2015-04-13Chainparams: Cleanup: Delete CChainParams getters to attributes from ↵Jorge Timón
Consensus::Params
2015-04-12Chainparams: Refactor: Remove redundant HashGenesisBlock() getterJorge Timón