aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
AgeCommit message (Collapse)Author
2014-12-23DOS: Respect max per-peer blocks in flight limitAdam Weiss
Don't allow immediate inv driven block downloads if a peer already has MAX_BLOCKS_IN_TRANSIT_PER_PEER active downloads. Prevents bogus inv spam from blowing up block transfer tracking data structures. Rebased-From: c90770430d7c1eb7ece2d4ddb987b0f2210fd86f Github-Pull: #5507
2014-12-23Reject headers that build on an invalid parentPieter Wuille
Rebased-From: 34970223472c9e83689a1c710eebc7c16f152b02 Github-Pull: #5459
2014-12-22Check against MANDATORY flags prior to accepting to mempoolPeter Todd
Previously transactions were only tested again the STANDARD_SCRIPT_VERIFY_FLAGS prior to mempool acceptance, so any bugs in those flags that allowed actually-invalid transactions to pass would result in allowing invalid transactions into the mempool. Fortunately there is a second check in CreateNewBlock() that would prevent those transactions from being mined, resulting in an invalid block, however this could still be exploited as a DoS attack. Rebased-From: 7c041b3b91aa08a8f5863382b865a5174281ad03
2014-12-19add missing CAutoFile::IsNull() check in mainPhilip Kaufmann
Rebased-From: 84857e87e42e412336ea60d0f8544c1679bab827 Github-Pull: #5437
2014-12-08Remove txn which are invalidated by coinbase maturity during reorgMatt Corallo
2014-12-08Remove coinbase-dependant transactions during reorg.Matt Corallo
This still leaves transactions in mempool that are potentially invalid if the maturity period has been reorged out of, but at least they're not missing inputs entirely.
2014-12-05Merge pull request #5181Wladimir J. van der Laan
afd4b94 Move CMerkleBlock and CPartialMerkleTree to their own file (Matt Corallo)
2014-12-05Merge pull request #5308Wladimir J. van der Laan
60d1ecd change nSubsidy's type from int64_t to CAmount (HarryWu)
2014-12-05Move CMerkleBlock and CPartialMerkleTree to their own fileMatt Corallo
2014-12-04Merge pull request #5394Wladimir J. van der Laan
307f7d4 Report script evaluation failures in log and reject messages (Pieter Wuille)
2014-12-02Report script evaluation failures in log and reject messagesPieter Wuille
2014-12-02Make comments in main an init doxygen compatibleMichael Ford
Fix typos where appropriate Update license/copyright
2014-11-28Merge pull request #5316Wladimir J. van der Laan
f86a24b Move `setmocktime` to hidden category (Wladimir J. van der Laan) bd9aebf Introduce a hidden category (Pieter Wuille) 0dd06b2 Delay writing block indexes in invalidate/reconsider (Pieter Wuille) 9b0a8d3 Add 'invalidateblock' and 'reconsiderblock' RPC commands. (Pieter Wuille)
2014-11-27Remove -printblock, -printblocktree, and -printblockindexPieter Wuille
2014-11-26Delay writing block indexes in invalidate/reconsiderPieter Wuille
2014-11-26Add 'invalidateblock' and 'reconsiderblock' RPC commands.Pieter Wuille
These can be used for testing reorganizations or for manual intervention in case of chain forks.
2014-11-26Merge pull request #5158Wladimir J. van der Laan
9ec75c5 Add a locking mechanism to IsInitialBlockDownload to ensure it never goes from false to true. (Ruben Dario Ponticelli) a2d0fc6 Fix IsInitialBlockDownload which was broken by headers first. (Ruben Dario Ponticelli)
2014-11-26Merge pull request #5321Wladimir J. van der Laan
34559c7 Make PruneBlockIndexCandidates safer (Pieter Wuille) cca48f6 Reset setBlockIndexCandidates once block index db loaded (21E14)
2014-11-25Merge pull request #5241Wladimir J. van der Laan
a206950 Introduce separate flushing modes (Pieter Wuille) 51ce901 Improve chainstate/blockindex disk writing policy (Pieter Wuille)
2014-11-24Merge pull request #5154Wladimir J. van der Laan
730b1ed Check pindexBestForkBase for null (21E14)
2014-11-24Introduce separate flushing modesPieter Wuille
2014-11-24Improve chainstate/blockindex disk writing policyPieter Wuille
There are 3 pieces of data that are maintained on disk. The actual block and undo data, the block index (which can refer to positions on disk), and the chainstate (which refers to the best block hash). Earlier, there was no guarantee that blocks were written to disk before block index entries referring to them were written. This commit introduces dirty flags for block index data, and delays writing entries until the actual block data is flushed. With this stricter ordering in writes, it is now safe to not always flush after every block, so there is no need for the IsInitialBlockDownload() check there - instead we just write whenever enough time has passed or the cache size grows too large. Also updating the wallet's best known block is delayed until this is done, otherwise the wallet may end up referring to an unknown block. In addition, only do a write inside the block processing loop if necessary (because of cache size exceeded). Otherwise, move the writing to a point after processing is done, after relaying.
2014-11-24Merge pull request #1816Wladimir J. van der Laan
b867e40 CreateNewBlock: Stick height in coinbase so we pass template sanity check (Luke Dashjr) 60755db submitblock: Check for duplicate submissions explicitly (Luke Dashjr) bc6cb41 QA RPC tests: Add tests block block proposals (Luke Dashjr) 9765a50 Implement BIP 23 Block Proposal (Luke Dashjr) 3dcbb9b Abstract DecodeHexBlk and BIP22ValidationResult functions out of submitblock (Luke Dashjr) 132ea9b miner_tests: Disable checkpoints so they don't fail the subsidy-change test (Luke Dashjr) df08a62 TestBlockValidity function for CBlock proposals (used by CreateNewBlock) (Luke Dashjr) 4ea1be7 CreateNewBlock and miner_tests: Also check generated template is valid by CheckBlockHeader, ContextualCheckBlockHeader, CheckBlock, and ContextualCheckBlock (Luke Dashjr) a48f2d6 Abstract context-dependent block checking from acceptance (Luke Dashjr)
2014-11-23Prioritize and display -testsafemode status in UIdexX7
Like in a real world situation, a safe mode test should also be visible in the UI. A test of safe mode is furthermore mostly relevant for developers, so it should not be overwritten by a warning about a pre-release test build.
2014-11-22Check pindexBestForkBase for null21E14
2014-11-21Merge pull request #5170Wladimir J. van der Laan
092b58d CBlockIndex::GetBlockWork() + GetProofIncrement(nBits) -> GetBlockProof(CBlockIndex) (jtimon) 22c4272 MOVEONLY: Move void UpdateTime() from pow.o to miner.o (plus fix include main.h -> chain.h) (jtimon)
2014-11-20Make PruneBlockIndexCandidates saferPieter Wuille
2014-11-20Check block header before accepting it.Daniel Kraft
Previously, AcceptBlockHeader did not check the header (in particular PoW). This made the client accept invalid-PoW-headers from peers in headers-first sync.
2014-11-19change nSubsidy's type from int64_t to CAmountHarryWu
2014-11-18TestBlockValidity function for CBlock proposals (used by CreateNewBlock)Luke Dashjr
2014-11-18Abstract context-dependent block checking from acceptanceLuke Dashjr
2014-11-12Merge pull request #5161Wladimir J. van der Laan
845c86d Do not use third party services for IP detection. (Gregory Maxwell)
2014-11-12Reset setBlockIndexCandidates once block index db loaded21E14
2014-11-07Do not use third party services for IP detection.Gregory Maxwell
This is a simplified re-do of closed pull #3088. This patch eliminates the privacy and reliability problematic use of centralized web services for discovering the node's addresses for advertisement. The Bitcoin protocol already allows your peers to tell you what IP they think you have, but this data isn't trustworthy since they could lie. So the challenge is using it without creating a DOS vector. To accomplish this we adopt an approach similar to the one used by P2Pool: If we're announcing and don't have a better address discovered (e.g. via UPNP) or configured we just announce to each peer the address that peer told us. Since peers could already replace, forge, or drop our address messages this cannot create a new vulnerability... but if even one of our peers is giving us a good address we'll eventually make a useful advertisement. We also may randomly use the peer-provided address for the daily rebroadcast even if we otherwise have a seemingly routable address, just in case we've been misconfigured (e.g. by UPNP). To avoid privacy problems, we only do these things if discovery is enabled.
2014-11-07Add a locking mechanism to IsInitialBlockDownload to ensure it never goes ↵Ruben Dario Ponticelli
from false to true.
2014-11-05Merge pull request #5173Wladimir J. van der Laan
50b43fd Be a bit more verbose during -loadblock if we already have blocks (Matt Corallo) 8375e22 Fix -loadblock after shutdown during IBD (Matt Corallo) 4ead850 Fix for crash during block download (Matt Corallo)
2014-11-03Merge pull request #5157Wladimir J. van der Laan
b4ee0bd Introduce preferred download peers (Pieter Wuille)
2014-11-03Merge pull request #5106Wladimir J. van der Laan
1bea2bb Rename ProcessBlock to ProcessNewBlock to indicate change of behaviour, and document it (Luke Dashjr) d29a291 Rename RPC_TRANSACTION_* errors to RPC_VERIFY_* and use RPC_VERIFY_ERROR for submitblock (Luke Dashjr) f877aaa Bugfix: submitblock: Use a temporary CValidationState to determine accurately the outcome of ProcessBlock, now that it no longer does the full block validity check (Luke Dashjr) 24e8896 Add CValidationInterface::BlockChecked notification (Luke Dashjr)
2014-10-29Be a bit more verbose during -loadblock if we already have blocksMatt Corallo
2014-10-29Fix -loadblock after shutdown during IBDMatt Corallo
2014-10-29Fix for crash during block downloadMatt Corallo
2014-10-29CBlockIndex::GetBlockWork() + GetProofIncrement(nBits) -> ↵jtimon
GetBlockProof(CBlockIndex)
2014-10-29Introduce preferred download peersPieter Wuille
2014-10-28Fix IsInitialBlockDownload which was broken by headers first.Ruben Dario Ponticelli
2014-10-28Rename ProcessBlock to ProcessNewBlock to indicate change of behaviour, and ↵Luke Dashjr
document it
2014-10-25Add SCRIPT_VERIFY_MINIMALDATA (BIP62 rules 3 and 4)Pieter Wuille
Also use the new flag as a standard rule, and replace the IsCanonicalPush standardness check with it (as it is more complete).
2014-10-22Merge pull request #4988Wladimir J. van der Laan
7b2bb96 Replace some function names with __func__ (Pieter Wuille) ed6d1a2 Keep information about all block files in memory (Pieter Wuille)
2014-10-22Merge pull request #5108Wladimir J. van der Laan
a873823 CAutoFile: Explicit Get() and remove unused methods (Wladimir J. van der Laan) fef24ca Add IsNull() to class CAutoFile and remove operator ! (Ruben Dario Ponticeli)
2014-10-22CAutoFile: Explicit Get() and remove unused methodsWladimir J. van der Laan
Also add documentation to some methods.
2014-10-21Replace some function names with __func__Pieter Wuille