aboutsummaryrefslogtreecommitdiff
path: root/src/test
AgeCommit message (Collapse)Author
2017-11-07Merge #11389: Support having SegWit always active in regtest (sipa, ajtowns, ↵MarcoFalke
jnewbery) d61845818 Have SegWit active by default (Pieter Wuille) 4bd89210a Unit tests for always-active versionbits. (Anthony Towns) d07ee77ab Always-active versionbits support (Pieter Wuille) 18e071841 [consensus] Pin P2SH activation to block 173805 on mainnet (John Newbery) 526023aa7 Improve handling of BIP9Deployment limits (Anthony Towns) Pull request description: Most tests shouldn't have to deal with the now-historical SegWit activation transition (and other deployments, but SegWit is certainly the hardest one to accomodate). This PR makes a versionbits starttime of -1 equal to "always active", and enables it by default for SegWit on regtest. Individual tests can override this by using the existing `-vbparams` option. A few unit tests and functional tests are adapted to indeed override vbparams, as they specifically test the transition. This is in preparation for wallet SegWit support, but I thought having earlier eyes on it would be useful. Tree-SHA512: 3f07a7b41cf46476e6c7a5c43244e68c9f41d223482cedaa4c02a3a7b7cd0e90cbd06b84a1f3704620559636a2268f5767d4c52d09c1b354945737046f618fe5
2017-11-06Have SegWit active by defaultPieter Wuille
2017-11-06Unit tests for always-active versionbits.Anthony Towns
2017-11-06[consensus] Pin P2SH activation to block 173805 on mainnetJohn Newbery
2017-11-02Add unit test for stale tip checkingSuhas Daftuar
2017-11-02Add CConnmanTest to mutate g_connman in testsJoão Barbosa
2017-11-02Connect to an extra outbound peer if our tip is staleSuhas Daftuar
If our tip hasn't updated in a while, that may be because our peers are not relaying blocks to us that we would consider valid. Allow connection to an additional outbound peer in that circumstance. Also, periodically check to see if we are exceeding our target number of outbound peers, and disconnect the one which has least recently announced a new block to us (choosing the newest such peer in the case of tie).
2017-10-28Merge #10409: [tests] Add fuzz testing for BlockTransactions and ↵Wladimir J. van der Laan
BlockTransactionsRequest fd3a2f3 [tests] Add fuzz testing for BlockTransactions and BlockTransactionsRequest (practicalswift) Pull request description: The `BlockTransactions` deserialization code is reachable with tainted data via `ProcessMessage(…, "BLOCKTXN", vRecv [tainted], …)`. The same thing applies to `BlockTransactionsRequest` which is reachable via `"GETBLOCKTXN"`. Tree-SHA512: 64560ea344bc6145b940472f99866b808725745b060dedfb315be400bd94e55399f50b982149645bd7af7ed9935fd28751d7daf0d3f94a8e2ed3bc52e3325ffb
2017-10-26Add unit test for outbound peer evictionSuhas Daftuar
2017-10-25[tests] Add fuzz testing for BlockTransactions and BlockTransactionsRequestpracticalswift
2017-10-12Merge #10099: Slightly Improve Unit Tests for CheckqueuePieter Wuille
8c2f4b888 Expose more parallelism with relaxed atomics (suggested in #9938). Fix a test to check the exclusive or of two properties rather than just or. (Jeremy Rubin) Pull request description: This PR is in response to #10026 and some feedback on #9938. ~Locally, all the checkqueue tests ran 3.2X faster on my machine. The worst offender, `test_CheckQueue_Correct_Random` ran 3.4X faster.~ 1. ~Removes `GetRand()` and replaces it with a single deterministic FastRandomContext instance.~ #10321 replicated this 1. Exposes more parallelism with relaxed atomics, increasing chance of catching a bug. This does not change performance on my machine. 1. Makes one test case more restrictive (xor instead of or, see #9938). Tree-SHA512: a59dfbee0273c713525a130dfedc1c7ff26f50c2aaca1e94ef5d759b1d6ea6338ffbd97f863b9f6209750d8a788a15fa8ae1bf26774ed2473c520811337e6b00
2017-10-05Merge #10440: [tests] Add libFuzzer supportWladimir J. van der Laan
f3ba869 [tests] Add libFuzzer support. (practicalswift) Pull request description: Add `libFuzzer` support. As discussed in [issue #10364](https://github.com/bitcoin/bitcoin/issues/10364#issuecomment-300000902). See http://llvm.org/docs/LibFuzzer.html#fuzzer-usage for usage instructions. Tree-SHA512: 32562a3a43eb07e79989d55eeb0bfe94e2cff060da8ff0cb50c2f838ef19f2fd583a3dc89074a6442bd3e395185d309371325ed9a0ef50065431d5ea7f099772
2017-10-03Merge #11293: Deduplicate CMerkleBlock construction code, add test coverageMarcoFalke
46ce223d1 Add tests for CMerkleBlock usage with txids specified (James O'Beirne) 5ab586f90 Consolidate CMerkleBlock constructor into a single method (James O'Beirne) Pull request description: What started as a simple task to add test coverage ended up giving way to a light refactoring. This consolidates the mostly-identical `CMerkleBlock` constructors into one (using C++11 constructor delegation) and adds coverage for the by-txids construction case. ### Before ![selection_006](https://user-images.githubusercontent.com/73197/30242104-0f381fe4-9545-11e7-9617-83b87fce0456.png) ### After ![selection_008](https://user-images.githubusercontent.com/73197/30242107-1425dfaa-9545-11e7-9e6b-2c3432517dd1.png) Tree-SHA512: eed84ed3e8bfc43473077b575c8252759a857e37275e4b36ca7cc2c17a65895e5f494bfd9d4aeab09fc6e98fc6a9c641ac7ecc0ddbeefe01a9e4308e7909e529
2017-10-02Merge #11284: Fix invalid memory access in CScript::operator+= ↵Wladimir J. van der Laan
(guidovranken, ajtowns) d601f16 Fix invalid memory access in CScript::operator+= (Anthony Towns) Pull request description: This is a fix for #11114 -- invoking "s += s" gets turned into "s.insert(s.end(), s.begin(), s.end())" which can result in an invalid memory access is s.capacity() < 2*s.size() (because s gets resized and possibly moved, so s.begin() and s.end() become invalid references when reading the values to be appended). The fix is straightforward: reserve enough space in advance, so that insert() doesn't need to resize and thus its arguments remain valid. A simple test case is added as well; though you probably need to run it via valgrind to actually catch the problem when it's not fixed... Tree-SHA512: 4720d0c17463fdc43b344c45fe603423d20b30d48da1b9d85eeedc505d7f34db1ed5495ef1556459ae962a94717e3c6e8fc441763771901efea210d01322b7ef
2017-10-02Merge #11422: qa: Verify DBWrapper iterators are taking snapshotsWladimir J. van der Laan
bb8376b Verify DBWrapper iterators are taking snapshots (Matt Corallo) Pull request description: The LevelDB docs seem to indicate that an iterator will not take snapshots (even providing instructions on how to do so yourself). In several of the places we use them, we assume snapshots to have been taken. In order to make sure LevelDB doesn't change out from under us (and to prevent the next person who reads the docs from having the same fright I did), verify that snapshots are taken in our tests. Tree-SHA512: 54f24dabc294962e9c20882f61809604421a661208d1568bb107102248603e8e7c12e929ccb0812a73d4e4f23fea61f1b48e7cc24da5a7260f1d14d89ba88cd6
2017-09-30Verify DBWrapper iterators are taking snapshotsMatt Corallo
The LevelDB docs seem to indicate that an iterator will not take snapshots (even providing instructions on how to do so yourself). In several of the places we use them, we assume snapshots to have been taken. In order to make sure LevelDB doesn't change out from under us (and to prevent the next person who reads the docs from having the same fright I did), verify that snapshots are taken in our tests.
2017-09-30Merge #11303: Fix estimatesmartfee rounding display issueMarcoFalke
1789e4675 Force explicit double -> int conversion for CFeeRate constructor (Matt Corallo) 53a6590f4 Make float <-> int casts explicit outside of test, qt, CFeeRate (Matt Corallo) 0b1b9148c Remove countMaskInv caching in bench framework (Matt Corallo) Pull request description: This fixes an issue where estimatesmartfee which matches at the min relay fee will return 999 sat/byte instead of 1000 sat/byte due to a float rounding issue. I went ahead and made all float <-> int conversion outside of test/qt explicit (test only had one or two more, Qt had quite a few, including many in the Qt headers themselves) and added overloads to CFeeRate to force callers to do an explicit round themselves. Easy to test with -Wfloat-conversion. Tree-SHA512: 66087b08e5dfca67506da54ae057c2f9d86184415e8fa4fa0199e38839e06a3ce96c836fcb7593b7d960065f5240c594ff3a0cfa14333ac528421f5aeac835c9
2017-09-29Merge #11309: Minor cleanups for AcceptToMemoryPoolMarcoFalke
bf64c3cb3 Ignore transactions added to mempool during a reorg for fee estimation purposes. (Alex Morcos) 04f78ab5b Do not reject based on mempool min fee when bypass_limits is set. (Alex Morcos) fd849e1b0 Change AcceptToMemoryPool function signature (Alex Morcos) Pull request description: First commit just removes default arguments from `AcceptToMemoryPool` and consolidates two arguments, it does not change behavior. Second commit finally fixes the fact that we're not meant to reject based on mempool min fee when adding a transaction from a disconnected block during a reorg as mentioned [here](https://github.com/bitcoin/bitcoin/pull/9602#issue-202197849) Third commit makes fee estimation ignore transactions added from a disconnected block during a reorg. I think this was another source of fee estimates returning estimates below 1000 sat/kB as in #11303. Tree-SHA512: 30925ca8b341915bb214f1d2590b36b7931f2e125b7660150e38ae70338f00db5aa7f1608546dddb181446924177eb7cf62ea8bd2583068acc074d6c3f86bc0c
2017-09-28Implement BIP173 addresses and testsPieter Wuille
2017-09-28Add regtest testing to base58_testsPieter Wuille
2017-09-28Convert base58_tests from type/payload to scriptPubKey comparisonPieter Wuille
2017-09-28Import Bech32 C++ reference code & testsPieter Wuille
This includes a reformatted version of the Bech32 reference code (see https://github.com/sipa/bech32/tree/master/ref/c%2B%2B), with extra documentation.
2017-09-22Merge #10953: [Refactor] Combine scriptPubKey and amount as CTxOut in ↵Pieter Wuille
CScriptCheck 3a131b724 Rename out to m_tx_out in CScriptCheck (Johnson Lau) e91211878 [Refactor] Combine scriptPubKey and amount as CTxOut in CScriptCheck (Johnson Lau) Pull request description: This simplifies CScriptCheck by combining scriptPubKey and amount Tree-SHA512: 6422363cf5394c6cfefb30c1709db6def63230b809cc7697887e4a2e8c684149208edf91dd139e031b9fe732776b2db59305f77c3cba6f333b11cceb39ef0cc2
2017-09-22Merge #11362: Remove nBlockMaxSize from miner opt struct as it is no longer ↵Pieter Wuille
used. 22fd04beb Remove nBlockMaxSize from miner opt struct as it is no longer used. (Gregory Maxwell) Pull request description: Tree-SHA512: f7a0fa380b4173120f33f96de90581cb57b8bd7af50996f0c726845acff7b92bb1212b924495ef89645624239d2b60d19c1cee2a13139b00e917154a33f7da4c
2017-09-21[script] Unit tests for IsMineJim Posen
Does not test watch-only addresses.
2017-09-21[script] Unit tests for script/standard functionsJim Posen
2017-09-20Add tests for CMerkleBlock usage with txids specifiedJames O'Beirne
2017-09-18Remove nBlockMaxSize from miner opt struct as it is no longer used.Gregory Maxwell
2017-09-12Change AcceptToMemoryPool function signatureAlex Morcos
Combine fLimitFree and fOverrideMempoolLimit into a single boolean: bypass_limits. This is used to indicate that mempool limiting based on feerate should be bypassed. It is used when readding transactions from a reorg and then the mempool is trimmed to size after all transactions are added and they can be evaluated in the context of their descendants. No changes to behavior.
2017-09-11Force explicit double -> int conversion for CFeeRate constructorMatt Corallo
This resolves an issue where estimatesmartfee would return 999 sat/byte instead of 1000, due to floating point loss of precision Thanks to sipa for suggesting is_integral.
2017-09-11Fix invalid memory access in CScript::operator+=Anthony Towns
2017-09-08Merge #10793: Changing &var[0] to var.data()Wladimir J. van der Laan
592404f03 Changing &vec[0] to vec.data(), what 9804 missed (MeshCollider) Pull request description: This just continues the work of https://github.com/bitcoin/bitcoin/pull/9804 Modifies a lot of `&vector[]`'s to `vector.data()`'s across all the files including tests, just the stuff that 9804 missed Tree-SHA512: dd1a9dffb999dea4fba78dcc91fe02f90250db86f5c74948e1ff3e8b4036b2154b600555eaa04dece5368920aae3513bc36425dc96e4319ca1041b0928a6b656
2017-09-08Changing &vec[0] to vec.data(), what 9804 missedMeshCollider
2017-09-06net: drop unused connman paramCory Fields
The copy in PeerLogicValidation can be used instead.
2017-09-06net: use an interface class rather than signals for message processingCory Fields
Drop boost signals in favor of a stateful class. This will allow the message processing loop to actually move to net_processing in a future step.
2017-09-06net: pass CConnman via pointer rather than referenceCory Fields
There are a few too many edge-cases here to make this a scripted diff. The following commits will move a few functions into PeerLogicValidation, where the local connman instance can be used. This change prepares for that usage.
2017-09-07Merge #11219: [docs] explain how to recompile a modified unit testWladimir J. van der Laan
478d4fb79 [docs] explain how to recompile only what bitcoind tests need (Sjors Provoost) Pull request description: It was not obvious to me to run `make` inside the test directory, especially because `make src/test` and `make src/test/test_bitcoin` result in `make: Nothing to be done for ...`. Tree-SHA512: 5fe66c45c50af42d4fed42e3008b1dc4de7ea448f5265a34f4b2f355aa4a48a8187918a49fc9f82e8dd9706bc72c59d0fd67d86057fd816eb317832e46ada7ba
2017-09-06Merge #11117: Prepare for non-Base58 addressesWladimir J. van der Laan
864cd2787 Move CBitcoinAddress to base58.cpp (Pieter Wuille) 5c8ff0d44 Introduce wrappers around CBitcoinAddress (Pieter Wuille) Pull request description: This patch removes the need for the intermediary Base58 type `CBitcoinAddress`, by providing {`Encode`,`Decode`,`IsValid`}`Destination` functions that directly operate on the conversion between `std::string`s and `CTxDestination`. As a side, it also fixes a number of indentation issues, and removes probably several unnecessary implicit `CTxDestination`<->`CBitcoinAddress` conversions. This change is far from complete. In follow-ups I'd like to: * Split off the specific address and key encoding logic from base58.h, and move it to a address.h or so. * Replace `CTxDestination` with a non-`boost::variant` version (which can be more efficient as `boost::variant` allocates everything on the heap, and remove the need for `boost::get<...>` and `IsValidDestination` calls everywhere). * Do the same for `CBitcoinSecret`, `CBitcoinExtKey`, and `CBitcoinExtPubKey`. However, I've tried to keep this patch to be minimally invasive, but still enough to support non-Base58 addresses. Perhaps a smaller patch is possible to hack Bech32 support into `CBitcoinAddress`, but I would consider that a move in the wrong direction. Tree-SHA512: c2c77ffb57caeadf2429b1c2562ce60e8c7be8aa9f8e51b591f354b6b441162625b2efe14c023a1ae485cf2ed417263afa35c892891dfaa7844e7fbabccab85e
2017-09-06Introduce wrappers around CBitcoinAddressPieter Wuille
This patch removes the need for the intermediary Base58 type CBitcoinAddress, by providing {Encode,Decode,IsValid}Destination function that directly operate on the conversion between strings and CTxDestination.
2017-09-06Merge #10357: Allow setting nMinimumChainWork on command lineWladimir J. van der Laan
eac64bb7a [qa] Test nMinimumChainWork (Suhas Daftuar) 0311836f6 Allow setting nMinimumChainWork on command line (Suhas Daftuar) Pull request description: As discussed briefly here: https://botbot.me/freenode/bitcoin-core-dev/2017-02-28/?msg=81712308&page=4 This adds a hidden command line option for setting `nMinimumChainWork`, which allows us to test this parameter in our functional tests, as well as allowing for niche use cases like syncing nodes that are otherwise disconnected from the network. See also #10345, which proposes a new use of `nMinimumChainWork`. Tree-SHA512: fe4d8f4f289697615c98d8760f1cc74c076110310ea0b5b875fcab78c127da9195b4eb84148aebacc7606c246e5773d3f13bd5d9559d0a8bffac20a3a28c62df
2017-09-06[docs] explain how to recompile only what bitcoind tests needSjors Provoost
`make` rebuilds the entire project. This is quite slow if e.g. you're making changes to one file and only wish to run the bitcoind tests. This commit adds an instruction to run `make -C src/test` (as opposed to `make src/test` and `make src/test/test_bitcoin`).
2017-09-05Allow setting nMinimumChainWork on command lineSuhas Daftuar
2017-09-05Remove redundant testutil filesMeshCollider
2017-08-30Merge #10777: [tests] Avoid redundant assignments. Remove unused variablesMarcoFalke
49eb0916d [tests] Avoid redundant assignments. Remove unused variables. (practicalswift) Pull request description: * Remove unused variables. * Avoid redundant assignments. Tree-SHA512: 74dd59680c785c601982a791648bc5d9b04e2b4509119e05f2e402b94998f5bbcbdea1f82d05e5f431fe06642e8db7c346fa8bc4c11f8cdcc554bc70d735534c
2017-08-30[Refactor] Combine scriptPubKey and amount as CTxOut in CScriptCheckJohnson Lau
2017-08-28Improve versionbits_computeblockversion test code consistencydanra
In this test, `nTime` is used for all the calls to `Mine()`, each time being set to the correct time beforehand, except for in the last few calls to `Mine()` where `nStartTime` is used directly, even though `nTime` is still set to `nStartTime` beforehand. `nTime` just remains unused for these last few calls to `Mine()`. Changed the last few calls to `Mine()` to use `nTime` instead, improving consistency. This also fixes an unused value static analyzer warning about `nTime` being set to a value which is never used.
2017-08-24Merge #11112: [developer-notes] By default, declare single-argument ↵MarcoFalke
constructors "explicit" f1708ef89 Add recommendation: By default, declare single-argument constructors `explicit` (practicalswift) Pull request description: This is a follow-up to the now merged #10969. Add recommendation: > By default, declare single-argument constructors `explicit`. > > - *Rationale*: This is a precaution to avoid unintended conversions that might arise when single-argument constructors are used as implicit conversion functions. > Tree-SHA512: 1ceb1008a7863ebd0f09ba9c06b4e28b3b03265d7381f9d0c8bd4be1663d5d0392de0ecd811027aa27c0d962723674b245b3c165a437942a776f3525db39d36b
2017-08-23Merge #10679: Document the non-DER-conformance of one test in tx_valid.json.Wladimir J. van der Laan
ecb11f5 Document the non-strict-DER-conformance of one test in tx_valid.json. (Andreas Schildbach) Tree-SHA512: 4d5ba4645fbfe8fe3f1baaa5f1a1152cdd2cbf3d901f38d8e7fbd56b16caa6a8a17f2a48c74fb725ce454dd1c870b81b2238e89d0639fcd4eee858554726e996
2017-08-23Document the non-strict-DER-conformance of one test in tx_valid.json.Andreas Schildbach
In a signature, it contains an ASN1 integer which isn't strict-DER conformant due to excessive 0xff padding: 0xffda47bfc776bcd269da4832626ac332adfca6dd835e8ecd83cd1ebe7d709b0e
2017-08-22Add recommendation: By default, declare single-argument constructors `explicit`practicalswift