aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
AgeCommit message (Collapse)Author
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-13Reduce checkpoints' effect on consensus.Pieter Wuille
Instead of only checking height to decide whether to disable script checks, actually check whether a block is an ancestor of a checkpoint, up to which headers have been validated. This means that we don't have to prevent accepting a side branch anymore - it will be safe, just less fast to do. We still need to prevent being fed a multitude of low-difficulty headers filling up our memory. The mechanism for that is unchanged for now: once a checkpoint is reached with headers, no headers chain branching off before that point are allowed anymore.
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-12Fix 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.
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
2015-04-08Merge pull request #5969Wladimir J. van der Laan
f14e687 Chainparams: Decouple CAlert from CChainParams (Jorge Timón)
2015-04-04Chainparams: Decouple CAlert from CChainParamsJorge Timón
2015-04-02Change download logic to allow calling getheaders/getdata on inbound peersSuhas Daftuar
SendMessages will now call getheaders on both inbound and outbound peers, once the headers chain is close to synced. It will also try downloading blocks from inbound peers once we're out of initial block download (so inbound peers will participate in parallel block fetching for the last day or two of blocks being downloaded).
2015-04-01Add additional block index consistency checksSuhas Daftuar
This adds more tests to CheckBlockIndex: - HAVE_DATA is true iff nTx > 0 - BLOCK_VALID_TRANSACTIONS is true iff nTx > 0 - BLOCK_VALID_TRANSACTIONS is true for a block and all parents iff nChainTx > 0
2015-04-01Merge pull request #5900Wladimir J. van der Laan
3fcfbc8 Add a consistency check for the block chain data structures (Pieter Wuille)
2015-03-30Merge pull request #5940Wladimir J. van der Laan
0f5954c Regression test for ResendWalletTransactions (Gavin Andresen)
2015-03-27Add a consistency check for the block chain data structuresPieter Wuille
This adds a -checkblockindex (defaulting to true for regtest), which occasionally does a full consistency check for mapBlockIndex, setBlockIndexCandidates, chainActive, and mapBlocksUnlinked.
2015-03-26Consensus: Refactor: Decouple pow.o from chainparams.oJorge Timón
2015-03-24Regression test for ResendWalletTransactionsGavin Andresen
Adds a regression test for the wallet's ResendWalletTransactions function, which uses a new, hidden RPC command "resendwallettransactions." I refactored main's Broadcast signal so it is passed the best-block time, which let me remove a global variable shared between main.cpp and the wallet (nTimeBestReceived). I also manually tested the "rebroadcast unconfirmed every half hour or so" functionality by: 1. Running bitcoind -connect=0.0.0.0:8333 2. Creating a couple of send-to-self transactions 3. Connect to a peer using -addnode 4. Waited a while, monitoring debug.log, until I see: ```2015-03-23 18:48:10 ResendWalletTransactions: rebroadcast 2 unconfirmed transactions``` One last change: don't bother putting ResendWalletTransactions messages in debug.log unless unconfirmed transactions were actually rebroadcast.
2015-03-24Includes: Refactor: Move CValidationInterface and CMainSignals out of mainJorge Timón
2015-03-24Merge pull request #5890Wladimir J. van der Laan
cd3d67c Fix InvalidateBlock to add chainActive.Tip to setBlockIndexCandidates (Alex Morcos)
2015-03-17Merge pull request #5860Wladimir J. van der Laan
9c27379 Reduce fingerprinting through timestamps in 'addr' messages. (Pieter Wuille)
2015-03-17Reduce fingerprinting through timestamps in 'addr' messages.Pieter Wuille
Suggested by Jonas Nick.