aboutsummaryrefslogtreecommitdiff
path: root/src/test/DoS_tests.cpp
Commit message (Collapse)AuthorAgeFilesLines
* 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
|/
* SigOp and orphan-tx constants and counts are always unsigned.Jeff Garzik2012-04-231-1/+1
| | | | Fixes several sign-comparison warnings.
* Fix tests after recent refactorsPieter Wuille2012-04-171-2/+2
|
* DoS fix for mapOrphanTransactionsv0.6.0rc2Gavin Andresen2012-02-291-0/+79
|
* Network stack refactorPieter Wuille2012-01-061-18/+25
| | | | | | | | | | | | | | | This introduces CNetAddr and CService, respectively wrapping an (IPv6) IP address and an IP+port combination. This functionality used to be part of CAddress, which also contains network flags and connection attempt information. These extra fields are however not always necessary. These classes, along with logic for creating connections and doing name lookups, are moved to netbase.{h,cpp}, which does not depend on headers.h. Furthermore, CNetAddr is mostly IPv6-ready, though IPv6 functionality is not yet enabled for the application itself.
* Revert "Use standard C99 (and Qt) types for 64-bit integers"Wladimir J. van der Laan2011-12-211-6/+4
| | | | This reverts commit 21d9f36781604e4ca9fc35dc65265593423b73e9.
* Use standard C99 (and Qt) types for 64-bit integersLuke Dashjr2011-12-201-4/+6
|
* Rework unit tests so test_bitcoin.cpp does not #include them allGavin Andresen2011-12-191-3/+4
|
* Orphan block fill-up-memory attack preventionGavin Andresen2011-12-011-0/+51
|
* Moved checkpoints out of main, to prep for using them to help prevent DoS ↵Gavin Andresen2011-12-011-1/+0
| | | | attacks
* Framework for banning mis-behaving peersGavin Andresen2011-09-211-0/+68