aboutsummaryrefslogtreecommitdiff
path: root/src/test/DoS_tests.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Move static global randomizer seeds into CConnmanPieter Wuille2016-09-191-4/+4
|
* net: Pass best block known height into CConnmanCory Fields2016-09-081-4/+4
| | | | | | | | | | | | | | | | | | | | CConnman then passes the current best height into CNode at creation time. This way CConnman/CNode have no dependency on main for height, and the signals only move in one direction. This also helps to prevent identity leakage a tiny bit. Before this change, an attacker could theoretically make 2 connections on different interfaces. They would connect fully on one, and only establish the initial connection on the other. Once they receive a new block, they would relay it to your first connection, and immediately commence the version handshake on the second. Since the new block height is reflected immediately, they could attempt to learn whether the two connections were correlated. This is, of course, incredibly unlikely to work due to the small timings involved and receipt from other senders. But it doesn't hurt to lock-in nBestHeight at the time of connection, rather than letting the remote choose the time.
* net: move nLocalServices/nRelevantServices to CConnmanCory Fields2016-09-081-4/+4
| | | | | These are in-turn passed to CNode at connection time. This allows us to offer different services to different peers (or test the effects of doing so).
* net: move nLastNodeId to CConnmanCory Fields2016-09-081-4/+6
|
* net: move ban and addrman functions into CConnmanCory Fields2016-09-081-14/+14
|
* net: handle nodesignals in CConnmanCory Fields2016-09-081-0/+4
|
* net: Pass CConnman around as neededCory Fields2016-09-081-7/+7
|
* BIP143: Signing logicPieter Wuille2016-06-221-2/+2
|
* Merge #8179: Evict orphans which are included or precluded by accepted blocks.Wladimir J. van der Laan2016-06-201-1/+1
|\ | | | | | | | | | | | | | | 54326a6 Increase maximum orphan size to 100,000 bytes. (Gregory Maxwell) 8c99d1b Treat orphans as implicit inv for parents, discard when parents rejected. (Gregory Maxwell) 11cc143 Adds an expiration time for orphan tx. (Gregory Maxwell) db0ffe8 This eliminates the primary leak that causes the orphan map to always grow to its maximum size. (Gregory Maxwell) 1b0bcc5 Track orphan by prev COutPoint rather than prev hash (Pieter Wuille)
| * Increase maximum orphan size to 100,000 bytes.Gregory Maxwell2016-06-151-1/+1
| | | | | | | | | | Although this increases node memory usage in the worst case by perhaps 30MB, the current behavior causes severe issues with dependent tx relay.
* | Introduce enum ServiceFlags for service flagsPieter Wuille2016-06-131-4/+4
| |
* | Don't require services in -addnodePieter Wuille2016-06-131-4/+4
|/
* Merge pull request #7205Wladimir J. van der Laan2016-01-051-1/+1
|\ | | | | | | | | | | fa71669 [devtools] Use git pretty-format for year parsing (MarcoFalke) fa24439 Bump copyright headers to 2015 (MarcoFalke) fa6ad85 [devtools] Rewrite fix-copyright-headers.py (MarcoFalke)
| * Bump copyright headers to 2015MarcoFalke2015-12-131-1/+1
| |
* | Replace trickle nodes with per-node/message Poisson delaysPieter Wuille2015-12-111-7/+7
|/ | | | | | | | | | | | | | We used to have a trickle node, a node which was chosen in each iteration of the send loop that was privileged and allowed to send out queued up non-time critical messages. Since the removal of the fixed sleeps in the network code, this resulted in fast and attackable treatment of such broadcasts. This pull request changes the 3 remaining trickle use cases by random delays: * Local address broadcast (while also removing the the wiping of the seen filter) * Address relay * Inv relay (for transactions; blocks are always relayed immediately) The code is based on older commits by Patrick Strateman.
* TRIVIAL: Missing includesJorge Timón2015-07-231-4/+1
|
* Reinitialize state in between individual unit tests.Pieter Wuille2015-03-031-1/+3
| | | | | This changes the TestingSetup fixture to be per-unit-test rather than global. Most tests don't need it, so it's only invoked in a few.
* Remove references to X11 licenceMichael Ford2014-12-161-1/+1
|
* Remove CheckMinWork, as we always know all parent headersPieter Wuille2014-10-141-45/+0
|
* test: Fix DoS tests after c74332cWladimir J. van der Laan2014-09-201-3/+7
| | | | Fix data structure mismatch ... The mind boggles that they were still passing at all.
* Move CTxDestination from script/script to script/standardPieter Wuille2014-09-161-3/+3
|
* Stricter handling of orphan transactionsGavin Andresen2014-09-101-4/+13
| | | | | | | Prevent denial-of-service attacks by banning peers that send us invalid orphan transactions and only storing orphan transactions given to us by a peer while the peer is connected.
* Separate script/signjtimon2014-09-081-1/+1
|
* Rename script.h/.cpp to scriptutils.h/.cpp (plus remove duplicated includes)jtimon2014-09-081-1/+1
|
* Merge pull request #4377Pieter Wuille2014-08-271-5/+1
|\ | | | | | | | | | | 654871d replace ComputeMinWork with CheckMinWork (jtimon) b343c1a Move CBlockIndex::GetBlockWork() to pow::GetProofIncrement(nBits) (jtimon) c2c02f3 Move UpdateTime to pow (jtimon)
| * replace ComputeMinWork with CheckMinWorkjtimon2014-08-231-5/+1
| |
* | Split up util.cpp/hWladimir J. van der Laan2014-08-261-0/+1
|/ | | | | | | | | | | | | | | | Split up util.cpp/h into: - string utilities (hex, base32, base64): no internal dependencies, no dependency on boost (apart from foreach) - money utilities (parsesmoney, formatmoney) - time utilities (gettime*, sleep, format date): - and the rest (logging, argument parsing, config file parsing) The latter is basically the environment and OS handling, and is stripped of all utility functions, so we may want to rename it to something else than util.cpp/h for clarity (Matt suggested osinterface). Breaks dependency of sha256.cpp on all the things pulled in by util.
* Remove timing-based signature cache unit testGavin Andresen2014-06-251-87/+0
| | | | | | | | | | | | | | | | | Two changes: First removes a unit test that fails in my development environment (OSX, compiled -g3 with clang). sipa says that's not terribly surprising; the CMutableTransaction change makes signing a little more expensive but verification quicker. The unit test timed sign+verify-uncached versus verify-cached-five-times. He also says the test will be invalid when libsec256kp1 is integrated (because validation is super-optimized over signing). core.h change fixes a compiler warning (clang -Wall : CMutableTransaction defined as struct, declared as class in script.h).
* Refactor proof of work related functions out of mainjtimon2014-06-231-0/+1
|
* Add CMutableTransaction and make CTransaction immutable.Pieter Wuille2014-06-211-6/+6
| | | | | In addition, introduce a cached hash inside CTransaction, to prevent recalculating it over and over again.
* Reduce bignum.h now it is only needed for scriptnum_testsPieter Wuille2014-05-091-1/+0
|
* Move {Get,Set}Compact from bignum to uint256Pieter Wuille2014-05-091-2/+2
|
* Add licenses for tests and test dataWladimir J. van der Laan2014-03-181-0/+4
| | | | | | | | - Add license headers to source files (years based on commit dates) in `src/test` as well as `qa` - Add `README.md` to `src/test/data` specifying MIT license Fixes #3848
* Per-peer block download tracking and stalled download detection.Pieter Wuille2014-02-081-1/+0
| | | | | | | | | Keep track of which block is being requested (and to be requested) from each peer, and limit the number of blocks in-flight per peer. In addition, detect stalled downloads, and disconnect if they persist for too long. This means blocks are never requested twice, and should eliminate duplicate downloads during synchronization.
* Add main-specific node statePieter Wuille2013-12-081-7/+19
|
* Cleanup code using forward declarations.Brandon Dahler2013-11-101-12/+14
| | | | | | | | | Use misc methods of avoiding unnecesary header includes. Replace int typedefs with int##_t from stdint.h. Replace PRI64[xdu] with PRI[xdu]64 from inttypes.h. Normalize QT_VERSION ifs where possible. Resolve some indirect dependencies as direct ones. Remove extern declarations from .cpp files.
* Simplify storage of orphan transactionsGavin Andresen2013-08-021-20/+9
| | | | | | | | | Orphan transactions were stored as a CDataStream pointer; this changes the mapOrphanTransactions data structures to store orphans as a CTransaction. This also fixes CVE-2013-4627 by always re-serializing transactions before relaying them.
* Introduce a CChainParameters singleton class and regtest mode.Mike Hearn2013-06-191-1/+2
| | | | | | | | | | | | | The new class is accessed via the Params() method and holds most things that vary between main, test and regtest networks. The regtest mode has two purposes, one is to run the bitcoind/bitcoinj comparison tool which compares two separate implementations of the Bitcoin protocol looking for divergence. The other is that when run, you get a local node which can mine a single block instantly, which is highly convenient for testing apps during development as there's no need to wait 10 minutes for a block on the testnet.
* Introduce script verification flagsPieter Wuille2012-11-151-5/+6
| | | | | | | | These flags select features to be enabled/disabled during script evaluation/checking, instead of several booleans passed along. Currently these flags are defined: * SCRIPT_VERIFY_P2SH: enable BIP16-style subscript evaluation * SCRIPT_VERIFY_STRICTENC: enforce strict adherence to pubkey/sig encoding standards.
* change blockchain -> block chain (spelling)Philip Kaufmann2012-10-211-3/+2
| | | | | - Wiki says "block chain" is correct ;) - remove some unneeded spaces I found in the source, while fixing the spelling
* UltraprunePieter Wuille2012-10-201-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Check for canonical public keys and signaturesPieter Wuille2012-09-211-5/+5
| | | | Only enabled inside tests for now.
* Bugfix: Fix a variety of misspellingsLuke Dashjr2012-08-011-1/+1
|
* Refactor: split CKeyID/CScriptID/CTxDestination from CBitcoinAddressPieter Wuille2012-05-241-5/+5
| | | | | | | | | | | | | | | | | This introduces internal types: * CKeyID: reference (hash160) of a key * CScriptID: reference (hash160) of a script * CTxDestination: a boost::variant of the former two CBitcoinAddress is retrofitted to be a Base58 encoding of a CTxDestination. This allows all internal code to only use the internal types, and only have RPC and GUI depend on the base58 code. Furthermore, the header dependencies are a lot saner now. base58.h is at the top (right below rpc and gui) instead of at the bottom. For the rest: wallet -> script -> keystore -> key. Only keystore still requires a forward declaration of CScript. Solving that would require splitting script into two layers.
* DoS_tests: fix signed/unsigned comparison warningsJeff Garzik2012-05-241-7/+7
| | | | | | | | | | | test/DoS_tests.cpp: In member function ‘void DoS_tests::DoS_mapOrphans::test_method()’: test/DoS_tests.cpp:200:41: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] test/DoS_tests.cpp:208:41: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] test/DoS_tests.cpp: In member function ‘void DoS_tests::DoS_checkSig::test_method()’: test/DoS_tests.cpp:260:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] test/DoS_tests.cpp:267:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] test/DoS_tests.cpp:280:41: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] test/DoS_tests.cpp:307:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
* Merge branch 'optimize'Gavin Andresen2012-05-221-13/+122
|\
| * Cache signature verificationsGavin Andresen2012-05-181-1/+92
| | | | | | | | | | | | | | | | | | Create a maximum-10MB signature verification result cache. This should almost double the number of transactions that can be processed on a given CPU, because before this change ECDSA signatures were verified when transactions were added to the memory pool and then again when they appeared in a block.
| * Optimize orphan transaction handlingGavin Andresen2012-05-181-2/+28
| | | | | | | | | | Changes suggested by Sergio Demian Lerner to help prevent potential DoS attacks.
| * Refactor: GetRandHash() method for utilGavin Andresen2012-05-171-10/+2
| |
* | Support for multiple local addressesPieter Wuille2012-05-041-4/+4
|/