aboutsummaryrefslogtreecommitdiff
path: root/src/test/coins_tests.cpp
AgeCommit message (Collapse)Author
2016-12-27Remove unused variable in test, fixing warning.Russell Yanofsky
Pointed out by Pavel Janík <Pavel@Janik.cz> in https://github.com/bitcoin/bitcoin/pull/9308.
2016-12-05[test] Add CCoinsViewCache Access/Modify/Write testsRussell Yanofsky
Add more comprehensive unit tests for CCoinsViewCache. Right now it is hard to refactor caching code or fix bugs in the caching logic because you have to try to mentally enumerate all the different states the cache might be in to make sure a change doesn't cause unintended consequences. The new tests explicitly enumerate relevant cache states, documenting and verifying the behavior in each state, so it will be safer and easier to make changes to the caching code in the future.
2016-12-02Rename the remaining main.{h,cpp} to validation.{h,cpp}Matt Corallo
2016-11-07test: Fix test_random includesMarcoFalke
2016-10-17Kill insecure_random and associated global stateWladimir J. van der Laan
There are only a few uses of `insecure_random` outside the tests. This PR replaces uses of insecure_random (and its accompanying global state) in the core code with an FastRandomContext that is automatically seeded on creation. This is meant to be used for inner loops. The FastRandomContext can be in the outer scope, or the class itself, then rand32() is used inside the loop. Useful e.g. for pushing addresses in CNode or the fee rounding, or randomization for coin selection. As a context is created per purpose, thus it gets rid of cross-thread unprotected shared usage of a single set of globals, this should also get rid of the potential race conditions. - I'd say TxMempool::check is not called enough to warrant using a special fast random context, this is switched to GetRand() (open for discussion...) - The use of `insecure_rand` in ConnectThroughProxy has been replaced by an atomic integer counter. The only goal here is to have a different credentials pair for each connection to go on a different Tor circuit, it does not need to be random nor unpredictable. - To avoid having a FastRandomContext on every CNode, the context is passed into PushAddress as appropriate. There remains an insecure_random for test usage in `test_random.h`.
2016-04-30Remove obsolete reference to CValidationState from UpdateCoins.21E14
2016-04-25Add tests for CCoins deserializationPieter Wuille
2016-04-15txdb: Add Cursor() method to CCoinsView to iterate over UTXO setWladimir J. van der Laan
Add a method Cursor() to CCoinsView that returns a cursor which can be used to iterate over the whole UTXO set. - rpc: Change gettxoutsetinfo to use new Cursor method - txdb: Remove GetStats method - Now that GetStats is implemented in terms of Cursor, remove it.
2015-12-13Bump copyright headers to 2015MarcoFalke
2015-11-18Alter assumptions in CCoinsViewCache::BatchWriteAlex Morcos
Previously it would break if you flushed a parent cache while there was a child cache referring to it. This change will allow the flushing of parent caches.
2015-11-12Add unit test for UpdateCoinsAlex Morcos
2015-11-11Make CCoinsViewTest behave like CCoinsViewDBAlex Morcos
2015-07-20Separate core memory usage computation in core_memusage.hPieter Wuille
2015-05-11Keep track of memory usage in CCoinsViewCachePieter Wuille
2015-03-12tests: add a BasicTestingSetup and apply to all testsWladimir J. van der Laan
Make sure that chainparams and logging is properly initialized. Doing this for every test may be overkill, but this initialization is so simple that that does not matter. This should fix the travis issues.
2014-09-24Get rid of the dummy CCoinsViewCache constructor argPieter Wuille
2014-09-23Add coins_tests with a large randomized CCoinViewCache test.Pieter Wuille