aboutsummaryrefslogtreecommitdiff
path: root/src/test/miner_tests.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Replace test data with Dogecoin valuesRoss Nicoll2019-04-031-32/+36
| | | | | | | | | | | | | | | | | | | | Replace test data with Dogecoin equivalents in the folowing tests: * base58 * bip32 * keys * miner * pow * wallet Replace RPC and deterministic signatures in unit tests with Dogecoin values. While conventionally I'd use an alternative implementation for these, as RFC 6979 compliant signature generation isn't terribly common, and there's no reason to suspect we've modified this code, I'm going to assert that it's good enough to test that the code doesn't provide different values. Disabled Bitcoin PoW tests, but left code in place to simplify later merges. These are replaced by the Dogecoin PoW tests.
* Merge #13780: 0.17: Pre-branch maintenanceWladimir J. van der Laan2018-08-081-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | 3fc20632a3ad30809356a58d2cf0ea4a4ad4cec3 qt: Set BLOCK_CHAIN_SIZE = 220 (DrahtBot) 2b6a2f4a28792f2fe9dc1be843b1ff1ecae35e8a Regenerate manpages (DrahtBot) eb7daf4d600eeb631427c018a984a77a34aca66e Update copyright headers to 2018 (DrahtBot) Pull request description: Some trivial maintenance to avoid having to do it again after the 0.17 branch off. (The scripts to do this are in `./contrib/`) Tree-SHA512: 16b2af45e0351b1c691c5311d48025dc6828079e98c2aa2e600dc5910ee8aa01858ca6c356538150dc46fe14c8819ed8ec8e4ec9a0f682b9950dd41bc50518fa
| * Update copyright headers to 2018DrahtBot2018-07-271-1/+1
| |
* | refactor: Avoid locking tx pool cs thriceMarcoFalke2018-07-291-1/+2
|/
* Remove redundant unused variablespracticalswift2018-07-181-1/+1
|
* Make it clear which functions that are intended to be translation unit localpracticalswift2018-05-031-3/+3
| | | | | Do not share functions that are meant to be translation unit local with other translation units. Use internal linkage for those consistently.
* test: Fix sign for expected valuesKarl-Johan Alm2018-04-111-2/+2
| | | | A number of BOOST_CHECK_EQUAL calls would result in warnings about signs.
* Increment MIT Licence copyright header year on files modified in 2017Akira Takizawa2018-01-031-1/+1
|
* Merge #11824: Block ActivateBestChain to empty validationinterface queuePieter Wuille2017-12-291-17/+21
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 97d2b09c12 Add helper to wait for validation interface queue to catch up (Matt Corallo) 36137497f1 Block ActivateBestChain to empty validationinterface queue (Matt Corallo) 5a933cefcc Add an interface to get the queue depth out of CValidationInterface (Matt Corallo) a99b76f269 Require no cs_main lock for ProcessNewBlock/ActivateBestChain (Matt Corallo) a734896038 Avoid cs_main in net_processing ActivateBestChain calls (Matt Corallo) 66aa1d58a1 Refactor ProcessGetData in anticipation of avoiding cs_main for ABC (Matt Corallo) 818075adac Create new mutex for orphans, no cs_main in PLV::BlockConnected (Matt Corallo) Pull request description: This should fix #11822. It ended up bigger than I hoped for, but its not too gnarly. Note that " Require no cs_main lock for ProcessNewBlock/ActivateBestChain" is mostly pure code-movement. Tree-SHA512: 1127688545926f6099449dca6a4e6609eefc3abbd72f1c66e03d32bd8c7b31e82097d8307822cfd1dec0321703579cfdd82069cab6e17b1024e75eac694122cb
| * Require no cs_main lock for ProcessNewBlock/ActivateBestChainMatt Corallo2017-12-261-17/+21
| | | | | | | | | | | | This requires the removal of some very liberal (incorrect) cs_mains sprinkled in some tests. It adds some chainActive.Tip() races, but the tests are all single-threaded anyway.
* | Merge #11220: Check specific validation error in miner testsWladimir J. van der Laan2017-12-191-5/+19
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 12781db [Tests] check specific validation error in miner tests (Sjors Provoost) Pull request description: ## Problem `BOOST_CHECK_THROW` merely checks that some `std::runtime_error` is thrown, but not which one. Here's an example of how this can cause a test to pass when a developer introduces a consensus bug. The test for the sigops limit assumes that `CreateNewBlock` fails with `bad-blk-sigops`. However it can also fail with bad-txns-vout-negative, if a naive developer lowers `BLOCKSUBSIDY` to `1*COIN`. ## Solution `BOOST_CHECK_EXCEPTION` allows an additional predicate function. This commit uses this for all exceptions that are checked for in `miner_tets.cpp`: * `bad-blk-sigops` * `bad-cb-multiple` * `bad-txns-inputs-missingorspent` * `block-validation-failed` If the function throws a different error, the test will fail. Although the message produced by Boost is a bit [confusing](http://boost.2283326.n4.nabble.com/Test-BOOST-CHECK-EXCEPTION-error-message-still-vague-tt4683257.html#a4683554), it does show which error was actually thrown. Here's what the above `1*COIN` bug would result in: <img width="1134" alt="schermafbeelding 2017-09-02 om 23 42 29" src="https://user-images.githubusercontent.com/10217/29998976-815cabce-9038-11e7-9c46-f5f6cfb0ca7d.png"> ## Other considerations A more elegant solution in my opinion would be to subclass `std::runtime_error` for each `INVALID_TRANSACTION` type, but this would involve touching consensus code. I put the predicates in `test_bitcoin.h` because I assume they can be reused in other test files. However [serialize_tests.cpp](https://github.com/bitcoin/bitcoin/blob/v0.15.0rc3/src/test/serialize_tests.cpp#L245) also uses `BOOST_CHECK_EXCEPTION` and it defines the predicate in the test file itself. Instead of four `IsRejectInvalidReasonX(std::runtime_error const& e)` functions, I'd prefer something reusable like `bool IsRejectInvalidReason(String reason)(std::runtime_error const& e)`, which would be used like `BOOST_CHECK_EXCEPTION(functionThatThrows(), std::runtime_error, IsRejectInvalidReason("bad-blk-sigops")`. I couldn't figure out how to do that in C++. Tree-SHA512: e364f19b4ac19f910f6e8d6533357f57ccddcbd9d53dcfaf923d424d2b9711446d6f36da193208b35788ca21863eadaa7becd9ad890334d334bccf8c2e63dee1
| * [Tests] check specific validation error in miner testsSjors Provoost2017-11-091-5/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | BOOST_CHECK_THROW merely checks that some std::runtime_error is thrown, but not which one. One example of how this could lead to a test passing when a developer introduces a consensus bug: the test for the sigops limit assumes that CreateNewBlock fails with bad-blk-sigops. However it can also fail with bad-txns-vout-negative, e.g. if a naive developer lowers BLOCKSUBSIDY to 1*COIN in the test. BOOST_CHECK_EXCEPTION allows an additional predicate function. This commit uses this for all exceptions that are checked for in miner_tets.cpp: * bad-blk-sigops * bad-cb-multiple * bad-txns-inputs-missingorspent * block-validation-failed An instance of the CheckRejectInvalid class (for a given validation string) is passed to BOOST_CHECK_EXCEPTION.
* | scripted-diff: Replace #include "" with #include <> (ryanofsky)MeshCollider2017-11-161-17/+17
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -BEGIN VERIFY SCRIPT- for f in \ src/*.cpp \ src/*.h \ src/bench/*.cpp \ src/bench/*.h \ src/compat/*.cpp \ src/compat/*.h \ src/consensus/*.cpp \ src/consensus/*.h \ src/crypto/*.cpp \ src/crypto/*.h \ src/crypto/ctaes/*.h \ src/policy/*.cpp \ src/policy/*.h \ src/primitives/*.cpp \ src/primitives/*.h \ src/qt/*.cpp \ src/qt/*.h \ src/qt/test/*.cpp \ src/qt/test/*.h \ src/rpc/*.cpp \ src/rpc/*.h \ src/script/*.cpp \ src/script/*.h \ src/support/*.cpp \ src/support/*.h \ src/support/allocators/*.h \ src/test/*.cpp \ src/test/*.h \ src/wallet/*.cpp \ src/wallet/*.h \ src/wallet/test/*.cpp \ src/wallet/test/*.h \ src/zmq/*.cpp \ src/zmq/*.h do base=${f%/*}/ relbase=${base#src/} sed -i "s:#include \"\(.*\)\"\(.*\):if test -e \$base'\\1'; then echo \"#include <\"\$relbase\"\\1>\\2\"; else echo \"#include <\\1>\\2\"; fi:e" $f done -END VERIFY SCRIPT-
* [consensus] Pin P2SH activation to block 173805 on mainnetJohn Newbery2017-11-061-17/+18
|
* Remove nBlockMaxSize from miner opt struct as it is no longer used.Gregory Maxwell2017-09-181-1/+0
|
* scripted-diff: Use the C++11 keyword nullptr to denote the pointer literal ↵practicalswift2017-08-071-1/+1
| | | | | | | | | | | | | instead of the macro NULL -BEGIN VERIFY SCRIPT- sed -i 's/\<NULL\>/nullptr/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h src/qt/*/*.cpp src/qt/*/*.h src/wallet/*/*.cpp src/wallet/*/*.h src/support/allocators/*.h sed -i 's/Prefer nullptr, otherwise SAFECOOKIE./Prefer NULL, otherwise SAFECOOKIE./g' src/torcontrol.cpp sed -i 's/tor: Using nullptr authentication/tor: Using NULL authentication/g' src/torcontrol.cpp sed -i 's/METHODS=nullptr/METHODS=NULL/g' src/test/torcontrol_tests.cpp src/torcontrol.cpp sed -i 's/nullptr certificates/NULL certificates/g' src/qt/paymentserver.cpp sed -i 's/"nullptr"/"NULL"/g' src/torcontrol.cpp src/test/torcontrol_tests.cpp -END VERIFY SCRIPT-
* Simplify "bool x = y ? true : false" to "bool x = y"practicalswift2017-06-111-3/+3
|
* scripted-diff: Use new naming style for insecure_rand* functionsPieter Wuille2017-06-071-2/+2
| | | | | | | | | | | | -BEGIN VERIFY SCRIPT- sed -i 's/\<insecure_randbits(/InsecureRandBits(/g' src/test/*.cpp src/test/*.h src/wallet/test/*.cpp sed -i 's/\<insecure_randbool(/InsecureRandBool(/g' src/test/*.cpp src/test/*.h src/wallet/test/*.cpp sed -i 's/\<insecure_randrange(/InsecureRandRange(/g' src/test/*.cpp src/test/*.h src/wallet/test/*.cpp sed -i 's/\<insecure_randbytes(/InsecureRandBytes(/g' src/test/*.cpp src/test/*.h src/wallet/test/*.cpp sed -i 's/\<insecure_rand256(/InsecureRand256(/g' src/test/*.cpp src/test/*.h src/wallet/test/*.cpp sed -i 's/\<insecure_rand(/InsecureRand32(/g' src/test/*.cpp src/test/*.h src/wallet/test/*.cpp sed -i 's/\<seed_insecure_rand(/SeedInsecureRand(/g' src/test/*.cpp src/test/*.h src/wallet/test/*.cpp -END VERIFY SCRIPT-
* scripted-diff: use insecure_rand256/randrange morePieter Wuille2017-06-051-2/+2
| | | | | | | | -BEGIN VERIFY SCRIPT- sed -i "s/\<GetRandHash(/insecure_rand256(/" src/test/*_tests.cpp sed -i "s/\<GetRand(/insecure_randrange(/" src/test/*_tests.cpp src/test/test_bitcoin.cpp sed -i 's/\<insecure_rand() % \([0-9]\+\)/insecure_randrange(\1)/g' src/test/*_tests.cpp -END VERIFY SCRIPT-
* Merge #8329: Consensus: MOVEONLY: Move functions for tx verificationWladimir J. van der Laan2017-05-181-0/+1
|\ | | | | | | | | | | 618d07f MOVEONLY: tx functions to consensus/tx_verify.o (Jorge Timón) Tree-SHA512: 63fa2777c070a344dbfe61974526a770d962e049881c6f371b0034b1682c1e6e24f47454f01ee35ded20ade34488e023d4467a05369662906b99a73bb5de8497
| * MOVEONLY: tx functions to consensus/tx_verify.oJorge Timón2017-04-061-0/+1
| | | | | | | | Functions related to transaction verification.
* | Chainparams: Get rid of CChainParams& Params(std::string)Jorge Timón2017-05-031-1/+2
|/
* Merge #9602: Remove coin age priority and free transactions - implementationWladimir J. van der Laan2017-03-071-3/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | b421e6d Update example bitcoin.conf (Alex Morcos) 7d4e950 Allow setting minrelaytxfee to 0 (Alex Morcos) 359e8a0 [cleanup] Remove coin age priority completely. (Alex Morcos) f9b9371 [rpc] Remove priorityDelta from prioritisetransaction (Alex Morcos) 49be7e1 [rpc] Remove priority information from mempool RPC calls (Alex Morcos) 0315888 [test] Remove priority from tests (Alex Morcos) f838005 No longer allow "free" transactions (Alex Morcos) ad727f4 [rpc] sendrawtransaction no longer bypasses minRelayTxFee (Alex Morcos) fe282ac [cleanup] Remove estimatePriority and estimateSmartPriority (Alex Morcos) 400b151 [debug] Change -printpriority option (Alex Morcos) 272b25a [mining] Remove -blockprioritysize. (Alex Morcos) 12839cd [rpc] Remove estimatepriority and estimatesmartpriority. (Alex Morcos) ddf58c7 wallet: Remove sendfree (MarcoFalke) Tree-SHA512: a9a4499405923ce794ef18f9e334dbbd59dfc73a3dc2df6f85cc9c62af6f353ec2eed9c2d5e58e904f918d0d7ab738f403dd4939d9bc2276136864fe63710782
| * [test] Remove priority from testsAlex Morcos2017-03-031-2/+1
| | | | | | | | Remove all coin age priority functionality from unit tests and RPC tests.
| * [mining] Remove -blockprioritysize.Alex Morcos2017-02-271-1/+0
| | | | | | | | Remove ability of mining code to fill part of a block with transactions sorted by coin age.
* | Run miner_tests with fixed optionsPieter Wuille2017-02-261-19/+28
|/
* Fix to have miner test aware of new separate block min tx feeAlex Morcos2017-01-191-4/+7
|
* Increment MIT Licence copyright header year on files modified in 2016isle29832016-12-311-1/+1
| | | | | | Edited via: $ contrib/devtools/copyright_header.py update .
* Remove unused CDiskBlockPos* argument from ProcessNewBlockMatt Corallo2016-12-041-1/+1
|
* Switch pblock in ProcessNewBlock to a shared_ptrMatt Corallo2016-12-041-1/+2
| | | | | This (finally) fixes a performance regression in b3b3c2a5623d5c942d2b3565cc2d833c65105555
* Rename the remaining main.{h,cpp} to validation.{h,cpp}Matt Corallo2016-12-021-1/+1
|
* Always add default_witness_commitment with GBT client supportPieter Wuille2016-11-211-0/+1
|
* Introduce convenience type CTransactionRefPieter Wuille2016-11-191-3/+3
|
* Make CBlock::vtx a vector of shared_ptr<CTransaction>Pieter Wuille2016-11-191-18/+15
|
* Replace CValidationState param in ProcessNewBlock with BlockCheckedMatt Corallo2016-11-091-3/+1
|
* Remove pfrom parameter from ProcessNewBlockMatt Corallo2016-11-091-1/+1
| | | | This further decouples ProcessNewBlock from networking/peer logic.
* Fix compact block handling to not ban if block is invalidSuhas Daftuar2016-11-031-1/+1
|
* Make removed and conflicted arguments optional to removePieter Wuille2016-10-211-2/+1
|
* Merge #8865: Decouple peer-processing-logic from block-connection-logicWladimir J. van der Laan2016-10-181-1/+1
|\ | | | | | | | | | | | | | | | | | | | | a9aec5c Use BlockChecked signal to send reject messages from mapBlockSource (Matt Corallo) 7565e03 Remove SyncWithWallets wrapper function (Matt Corallo) 12ee1fe Always call UpdatedBlockTip, even if blocks were only disconnected (Matt Corallo) f5efa28 Remove CConnman parameter from ProcessNewBlock/ActivateBestChain (Matt Corallo) fef1010 Use CValidationInterface from chain logic to notify peer logic (Matt Corallo) aefcb7b Move net-processing logic definitions together in main.h (Matt Corallo) 0278fb5 Remove duplicate nBlocksEstimate cmp (we already checked IsIBD()) (Matt Corallo) 87e7d72 Make validationinterface.UpdatedBlockTip more verbose (Matt Corallo)
| * Remove CConnman parameter from ProcessNewBlock/ActivateBestChainMatt Corallo2016-10-041-1/+1
| |
* | Merge #8223: [c++11] Use std::unique_ptr for block creation.Wladimir J. van der Laan2016-10-181-11/+4
|\ \ | |/ |/| | | 9fce062 [c++11] Use std::unique_ptr for block creation. (Daniel Kraft)
| * [c++11] Use std::unique_ptr for block creation.Daniel Kraft2016-06-181-11/+4
| | | | | | | | | | | | CreateNewBlock returns a pointer for which the caller takes ownership. Use std::unique_ptr to make this explicit and simplify handling of these objects in getblocktemplate.
* | net: Pass CConnman around as neededCory Fields2016-09-081-1/+1
| |
* | Enable size accounting in mining unit testsSuhas Daftuar2016-07-281-3/+1
| |
* | BIP141: Other consensus critical limits, and BIP145Pieter Wuille2016-06-221-1/+4
|/ | | | Includes changes by Suhas Daftuar, Luke-jr, and mruddy.
* Add unit tests for ancestor feerate miningSuhas Daftuar2016-06-161-0/+109
|
* Merge #7598: Refactor CreateNewBlock to be a method of the BlockAssembler classWladimir J. van der Laan2016-06-131-14/+14
|\ | | | | | | | | | | c2dd5a3 FIX: correctly measure size of priority block (Alex Morcos) a278764 FIX: Account for txs already added to block in addPriorityTxs (Alex Morcos) 4dc94d1 Refactor CreateNewBlock to be a method of the BlockAssembler class (Alex Morcos)
| * Refactor CreateNewBlock to be a method of the BlockAssembler classAlex Morcos2016-05-181-14/+14
| |
* | Do not shadow local variablesPavel Janík2016-06-071-2/+2
|/
* Corrected valuesinstagibbs2016-04-071-2/+2
|