aboutsummaryrefslogtreecommitdiff
path: root/src/test
AgeCommit message (Collapse)Author
2019-01-14Merge #15114: Qt: Replace remaining 0 with nullptrWladimir J. van der Laan
3a0e76fc12b91b2846d756981e15f09b767a9c37 Replace remaining 0 with nullptr in Qt code (Ben Woosley) 9096276e0b2d5b7e19af9a5f3c144ef108ee55e0 Don't use zero as null pointer constant (-Wzero-as-null-pointer-constant) (practicalswift) Pull request description: This corrects all violations of `-Wzero-as-null-pointer-constant` identified in the Qt codebase. These changes are extracted from #15112 as suggested by @MarcoFalke to ease review. This is in service of enabling `-Wzero-as-null-pointer-constant`, which should eliminate this as a concern going forward. Note there are 2 non-Qt changes: `src/test/allocator_tests.cpp` and `src/wallet/db.cpp`. Tree-SHA512: 206bd668802147ba42bc413c2d7d259cb59aca9ec1da74a6bf2ca3932e60ae492faacbc61bcee0fd6b4b49a4d59d075b7e5404f0526b36c47718f9b0587e7768
2019-01-14Merge #15138: Drop IsLimited in favor of IsReachableWladimir J. van der Laan
d6b076c17bc7d513243711563b262524ef0ba74c Drop IsLimited in favor of IsReachable (Ben Woosley) Pull request description: These two methods have had the same meaning, but inverted, since 110b62f06992d0fb989153afff2dc3aea62a674f. Having one name for a single concept simplifies the code. This is a follow-up to #15051. /cc #7553 Tree-SHA512: 347ceb9e2a55ea06f4c01226411c7bbcade09dd82130e4c59d0824ecefd960875938022edbe5d4bfdf12b0552c9b4cb78b09a688284d707119571daf4eb371b4
2019-01-13Drop IsLimited in favor of IsReachableBen Woosley
These two methods have had the same meaning, but inverted, since 110b62f06992d0fb989153afff2dc3aea62a674f. Having one name for a single concept simplifies the code.
2019-01-13Replace remaining 0 with nullptr in Qt codeBen Woosley
Also used type-appropriate enum values such as Qt::NoItemFlags in some cases. All cases identified via -Wzero-as-null-pointer-constant
2019-01-10util: Make ToLower and ToUpper take a charWladimir J. van der Laan
Unfortunately, `std::string` elements are (bare) chars. As these are the most likely type to be passed to these functions, make them use char instead of unsigned char. This avoids some casts.
2019-01-10Replace use of BEGIN and END macros on uint256Wladimir J. van der Laan
Replace use of `BEGIN` and `END` macros on uint256 with `begin()` and `end()` methods in the Merkle tree code.
2019-01-09Merge #14599: Use functions guaranteed to be locale independent (IsDigit, ↵Wladimir J. van der Laan
ToLower) in {Format,Parse}Money(...), uint256::SetHex(...), etc. Remove the use of locale dependent boost::is_space(...) 8931a95beca2b959c7ee73b154ce8a69acbe8599 Include util/strencodings.h which is required for IsSpace(...) (practicalswift) 7c9f7907615ff9c10a56ede5a8e47c91cb20fe3b Update KNOWN_VIOLATIONS: Remove fixed violations (practicalswift) 587924f0006d2eb9b8218b6abffe181bb9c27513 Use IsSpace(...) instead of boost::is_space (practicalswift) c5fd143edb85d0c181e21a429f9e29d12a611831 Use ToLower(...) instead of std::tolower (practicalswift) e70cc8983c570bbacee37a67df86b1bf959894df Use IsDigit(...) instead of std::isdigit (practicalswift) Pull request description: * Use `ToLower(...)` instead of `std::tolower`. `std::tolower` is locale dependent. * Use `IsDigit(...)` instead of `std::isdigit`. Some implementations (e.g. Microsoft in 1252 codepage) may classify single-byte characters other than `[0-9]` as digits. * Update `KNOWN_VIOLATIONS`: Remove fixed violations. * ~~Replace use of locale dependent Boost trim (`boost::trim`) with locale independent `TrimString`.~~ * Use` IsSpace(...)` instead of `boost::is_space` Tree-SHA512: defed016136b530b723fa185afdbd00410925a748856ba3afa4cee60f61a67617e30f304f2b9991a67b5fe075d9624f051e14342aee176f45fbc024d59e1aa82
2019-01-09Merge #15051: Tests: IsReachable is the inverse of IsLimited (DRY). Includes ↵Wladimir J. van der Laan
unit tests 6dc4593db1ccfb8745b2daa42f457981ae08dba9 IsReachable is the inverse of IsLimited (DRY). Includes unit tests (marcaiaf) Pull request description: IsReachable is the inverse of IsLimited, but the implementation is duplicated (DRY) - Changed the implementation accordingly. - Added unit tests to document behavior and relationship - My modification in net.cpp applies only to IsReachable. - Applied clang-format-diffpy Created new pull request to avoid the mess with: https://github.com/bitcoin/bitcoin/pull/15044 Checked with supposedly conflicting PRs mentioned in the old PR. No conflicts with the specific changes in this PR. Tree-SHA512: b132dec6cc2c788ebe4f63f228d78f441614e156743b17adebc990de0180a5872874d2724c86eeaa470b4521918bd137b0e33ebcaae77c5efc1f0d56104f6c87
2019-01-09Merge #15109: refactor: Use C++11 default member initializersWladimir J. van der Laan
fa2510d5c1cdf9c2cd5cc9887302ced4378c7202 Use C++11 default member initializers (MarcoFalke) Pull request description: Changes: * Remove unused constructors that leave some members uninitialized * Remove manual initialization in each constructor and prefer C++11 default member initializers This is not a stylistic change, but a change that avoids bugs such as: * fix uninitialized read when stringifying an addrLocal #14728 * qt: Initialize members in WalletModel #12426 * net: correctly initialize nMinPingUsecTime #6636 * ... Tree-SHA512: 0f896f3b9fcc464d5fc7525f7c86343ef9ce9fb13425fbc68e9a9728fd8710c2b4e2fd039ee08279ea41ff20fd92b7185cf5cca95a0bcb6a5340a1e6f03cae6b
2019-01-09Merge #14085: index: Fix for indexers skipping genesis block.Wladimir J. van der Laan
ed12d5df1ba52b5ef3dd3799de26bb5e1d3fc654 index: Fix for indexers skipping genesis block. (Jim Posen) Pull request description: This fixes a bug where indexers would skip processing of the genesis block. Preserves the current behavior of omitting genesis block transaction from the index. Tree-SHA512: 092fd3d629bf1ef279566217c668cc913a8b8e012d811d0e544231894c49a0c0c179537ac4727c39b9bf407479541745d79c4e118db6f0795a2b848d0fe62cbf
2019-01-05Use C++11 default member initializersMarcoFalke
2019-01-05Merge #14357: streams: Fix broken streams_vector_reader test. Remove unused ↵MarcoFalke
seek(size_t). 4f4993fe2a Remove UBSan suppression (practicalswift) 958e1a307e streams: Remove unused seek(size_t) (practicalswift) Pull request description: Fix broken `streams_vector_reader` test. Remove unused `seek(size_t)`. Before this change the test `streams_vector_reader` triggered an unintended unsigned integer wraparound. It tried so seek using a negative value in `reader.seek(-6)`. Changes in this PR: * Fix broken `VectorReader::seek(size_t)` test case * Remove unused `seek(size_t)` Tree-SHA512: 6c6affd680626363eef9e496748f2f86a522325abab9d6b13161f41125cdc29ceb36c2c1509c90b8ff108d606df7629e55e094cc2b6253b05a892b81ce176b71
2019-01-05Merge #15099: tests: Use std::vector API for construction of test dataMarcoFalke
6b25f29a91 Use std::vector API for construction of test data. (Daniel Kraft) Pull request description: For constructing test scripts, use `std::vector` and, in particular, `std::vector::insert` to insert 20 zero bytes rather than listing the full array of bytes explicitly. This makes the code easier to read and makes it immediately obvious what the structure of the data is, without having to count the zeros to understand it. Of course, that is a matter of taste - so if you disagree that the change makes the code easier to read, let me know. This has been split out of #14752. Tree-SHA512: af82d447f0077259049f1da2d6f86a6c29723c6e17bd342e9a9ecf37b13bddff40643af95c8b3a3260765a5591713d31ca8a45a5a0c20a12c139aee53ea150da
2019-01-04Merge #12151: rpc: Remove cs_main lock from blockToJSON and blockheaderToJSONMarcoFalke
b9f226b41f rpc: Remove cs_main lock from blockToJSON and blockHeaderToJSON (João Barbosa) 343b98cbcd rpc: Specify chain tip instead of chain in GetDifficulty (João Barbosa) 54dc13b6a2 rpc: Fix SoftForkMajorityDesc and SoftForkDesc signatures (João Barbosa) Pull request description: Motivated by https://github.com/bitcoin/bitcoin/pull/11913#discussion_r157798157, this pull makes `blockToJSON` and `blockheaderToJSON` free of `cs_main` locks. Locking `cs_main` was required to access `chainActive` in order to check if the block was in the chain and to retrieve the next block index. With the this approach, `CBlockIndex::GetAncestor()` is used in a way to check if the block belongs to the specified chain tip and, at the same time, get the next block index. Tree-SHA512: a6720ace0182c19033bbed1a404f729d793574db8ab16e0966ffe412145611e32c30aaab02975d225df6d439d7b9ef2070e732b16137a902b0293c8cddfeb85f
2019-01-04Merge #14855: test: Correct ineffectual WithOrVersion from transactions_testsMarcoFalke
75778a0724 test: Correct ineffectual WithOrVersion from transactions_tests (Ben Woosley) Pull request description: `WithOrVersion` uses `|` to combine the versions, and `|` with 0 is a no-op. NicolasDorier / sipa do you recall why the version is being overridden here? Introduced in ab48c5e72156b34300db4a6521cb3c9969be3937 Last updated 81e3228fcb33e8ed32d8b9fbe917444ba080073a Tree-SHA512: 2aea925497bab2da973f17752410a6759d67181a57c3b12a685d184fbfcca2984c45b702ab0bd641d75e086696a0424f1bf77c5578ca765d6882dc03b42d5f9a
2019-01-04Use std::vector API for construction of test data.Daniel Kraft
For constructing test scripts, use std::vector and, in particular, std::vector::insert to insert 20 zero bytes rather than listing the full array of bytes explicitly. This makes the code easier to read and makes it immediately obvious what the structure of the data is, without having to count the zeros to understand it.
2019-01-03test: Correct ineffectual WithOrVersion from transactions_testsBen Woosley
WithOrVersion uses | to combine the versions, and | with 0 is a no-op. Instead I run it with PROTOCOL_VERSION and 0 separately, as the original code only tested PROTOCOL_VERSION but apparently only intended to test version 0. Introduced in ab48c5e72156b34300db4a6521cb3c9969be3937 Last updated 81e3228fcb33e8ed32d8b9fbe917444ba080073a
2018-12-31Merge #15054: Update copyright headers to 2018MarcoFalke
1a49a0e310 Bump manpages (DrahtBot) 06ba77973e Update copyright headers to 2018 (DrahtBot) Pull request description: * `./contrib/devtools/copyright_header.py update ./` * `./contrib/devtools/gen-manpages.sh` Tree-SHA512: ca0dc5e97f4c33814d4ccd17769bbf2d23a99a71d62534fe1064fedfe47de3b5c30caf9b6deb0d70bf125e08c7ae6335ac4fcded918049d6b63b13b319d798e3
2018-12-29Merge #13743: refactor: Replace boost::bind with std::bindMarcoFalke
cb53b825c2 scripted-diff: Replace boost::bind with std::bind (Chun Kuan Lee) 2196c51821 refactor: Use boost::scoped_connection in signal/slot, also prefer range-based loop instead of std::transform (Chun Kuan Lee) Pull request description: Replace boost::bind with std::bind - In `src/rpc/server.cpp`, replace `std::transform` with simple loop. - In `src/validation.cpp`, store the `boost::signals2::connection` object and use it to disconnect. - In `src/validationinterface.cpp`, use 2 map to store the `boost::signals2::scoped_connection` object. Tree-SHA512: 6653cbe00036fecfc495340618efcba6d7be0227c752b37b81a27184433330f817e8de9257774e9b35828026cb55f11ee7f17d6c388aebe22c4a3df13b5092f0
2018-12-29Update copyright headers to 2018DrahtBot
2018-12-28IsReachable is the inverse of IsLimited (DRY). Includes unit testsmarcaiaf
2018-12-22Merge #14172: Refactor and add tests for BlockFilter constructionMarcoFalke
e4ed8ce2c8 blockfilter: Remove default clause in switch statement. (Jim Posen) c30620983d blockfilter: Additional constructors for BlockFilter. (Jim Posen) 20b812993a blockfilter: Refactor GCS params into struct. (Jim Posen) Pull request description: These commits have been split out of #14121 because they are fairly independent and that PR is very large. Tree-SHA512: b9643b159e114df50a295f433e807afe6082db55a2a3a17401c1509b850c71bf5011ab3638863b46663709726be4445be6fde1dec514aec7696135497a9f0183
2018-12-21Merge #14811: Mining: Enforce that segwit option must be set in GBTMarcoFalke
d2ce315fbf [docs] add release note for change to GBT (John Newbery) 0025c9eae4 [mining] segwit option must be set in GBT (John Newbery) Pull request description: Calling getblocktemplate without the segwit rule specified is most likely a client error, since it results in lower fees for the miner. Prevent this client error by failing getblocktemplate if called without the segwit rule specified. Of the previous 1000 blocks (measured at block [551591 (hash 0x...173c811)](https://blockstream.info/block/000000000000000000173c811e79858808abc3216af607035973f002bef60a7a)), 991 included segwit transactions. Tree-SHA512: 7933b073d72683c9ab9318db46a085ec19a56a14937945c73f783ac7656887619a86b74db0bdfcb8121df44f63a1d6a6fb19e98505b2a26a6a8a6e768e442fee
2018-12-17test: Add comment to g_insecure_rand_ctxMarcoFalke
2018-12-17test: Undo thread_local g_insecure_rand_ctxMarcoFalke
2018-12-15Fix cuckoocache_tests TSAN failure introduced in #14935. Fixes #14967.practicalswift
2018-12-14Merge #14935: tests: Test for expected return values when calling functions ↵MarcoFalke
returning a success code c84c2b8c92 tests: Test for expected return values when calling functions returning a success code (practicalswift) Pull request description: Test for expected return values when calling functions returning a success code (instead of discarding the return values). **Note to reviewers:** The following commands can be used to verify that the only text fragments added in this PR are `BOOST_CHECK(`, `!` and `)` : ``` $ git diff HEAD~1 | grep -E '^[\-][^\-]' | cut -b2- > before.txt $ git diff HEAD~1 | grep -E '^[\+][^\+]' | cut -b2- > after.txt $ cat after.txt | sed 's/BOOST_CHECK(//g' | sed 's/));/);/g' | tr -d '!' > after-sed.txt $ diff -u before.txt after-sed.txt $ ``` Tree-SHA512: ff0863ef2046a2eda3c44e9c6b9aedfe167881f2fa58db29fef859416831233ef6502a3a11fd2322bc1a924db83df8d4a5c5879298007f2a7b085e2a7286af70
2018-12-13test: Make g_insecure_rand_ctx thread_localMarcoFalke
2018-12-13Merge #14940: test: Add test for truncated pushdata scriptWladimir J. van der Laan
fa694f706c37a1c512a7c346591a63c5e09ee239 test: Add tests for truncated scripts (MarcoFalke) Pull request description: Previously not covered by any test Tree-SHA512: 9f99659bdf3947271074938456a2fe64f5b39fc868e9aa474cec199a536ae5d7428f1cfa7f361936b71b09ee4c426261e6b25668fa77b8416b30dbe4ddb357f0
2018-12-13tests: Test for expected return values when calling functions returning a ↵practicalswift
success code
2018-12-12Simplify testing RNG codePieter Wuille
2018-12-12Make unit tests use the insecure_rand_ctx exclusivelyPieter Wuille
2018-12-12Bugfix: randbytes should seed when needed (non reachable issue)Pieter Wuille
2018-12-12Introduce a Shuffle for FastRandomContext and use it in wallet and coinselectionPieter Wuille
2018-12-12Make addrman use its local RNG exclusivelyPieter Wuille
2018-12-12test: Add tests for truncated scriptsMarcoFalke
2018-12-12Merge #14908: test: Removed implicit CTransaction constructor calls from ↵MarcoFalke
tests and benchmarks. 8db0c3d42b Removed implicit CTransaction conversion from benchmaks (lucash-dev) ed61abedb2 Removed implicit CTransaction constructor from tests (lucash-dev) Pull request description: This PR was split from #14906 and is a prerequisite for it. It updates tests and benchmarks, removing all implicit calls to `CTransaction(CMutableTransaction&)` constructors. This will make possible making the constructor explicit in the next PR. The original rationale for making the constructor explicit: - Conversion constructors should not be explicit unless there's a strong reason for it (in the opinion of, for example, https://google.github.io/styleguide/cppguide.html, and https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Ro-conversion. Let me know your take on this). - This particular conversion is very costly -- it implies a serialization plus hash of the transaction. - Even though `CTransaction` and `CMutableTransaction` represent the same data, they have very different use cases and performance properties. - Making it explicit allows for easier reasoning of performance trade-offs. - There has been previous performance issues caused by unneeded use of this implicit conversion. - This PR creates a map for places to look for possible refactoring and performance gains (this benefit still holds if the PR is not merged). Tree-SHA512: de8073aa6ff8a3153bcbe10818616677ecf9598e4978d8a0b4c39a262e71c36be5679cec08554c760d1f011ba6d37350318248eef15f6d9b86f9e4462b2de0d2
2018-12-12Merge #13076: Fix ScanForWalletTransactions to return an enum indicating ↵MeshCollider
scan result: success / failure / user_abort bd3b0361d Add stop_block out arg to ScanForWalletTransactions (Ben Woosley) 3002d6cf3 Return a status enum from ScanForWalletTransactions (Ben Woosley) bb24d6865 Make CWallet::ScanForWalletTransactions args and return value const (Ben Woosley) Pull request description: Return the failed block as an out arg. Fixes #11450. /cc #12275 Tree-SHA512: 6a523e5425ebfe24e664a942ae21c797ccc1281c25b1bf8d02ad95c19dae343fd8051985ef11853474de7628fd6bed5f15190fbc087c3466ce6fdecab37d72a9
2018-12-12Merge #14646: Add expansion cache functions to descriptors (unused for now)MeshCollider
26879509f Add comments to descriptor tests (Pieter Wuille) 82df4c64f Add descriptor expansion cache (Pieter Wuille) 1eda33aab [refactor] Combine the ToString and ToPrivateString implementations (Pieter Wuille) 24d3a7b3a [refactor] Use DescriptorImpl internally, permitting access to new methods (Pieter Wuille) 6be0fb4b3 [refactor] Add a base DescriptorImpl with most common logic (Pieter Wuille) Pull request description: This patch modifies the internal `Descriptor` class to optionally construct and use an "expansion cache". Such a cache is a byte array that encodes all information necessary to expand a `Descriptor` a second time without access to private keys, and without the need to perform expensive BIP32 derivations. For all currently defined descriptors, the cache simply contains a concatenation of all public keys used. This is motivated by the goal of importing a descriptor into the wallet and using it as a replacement for the keypool, where it would be impossible to expand descriptors if they use hardened derivation. Tree-SHA512: f531a0a82ec1eecc30b78ba8a31724d1249826b028cc3543ad32372e1aedd537f137ab03dbffc222c5df444d5865ecd5cec754c1ae1d4989b6e9baeaffade32a
2018-12-11Removed implicit CTransaction constructor from testslucash-dev
2018-12-10[mining] segwit option must be set in GBTJohn Newbery
Calling getblocktemplate without the segwit rule specified is most likely a client error, since it results in lower fees for the miner. Prevent this client error by failing getblocktemplate if called without the segwit rule specified.
2018-12-06rpc: Avoid creating non-standard raw transactionsMarcoFalke
2018-12-06Merge #14838: Use const in COutPoint classWladimir J. van der Laan
cf4b0327ed92ca8a1533cdf6c2b0015fd9b56397 Use std::numeric_limits<UNSIGNED>::max()) instead of (UNSIGNED)-1 (practicalswift) 6b82fc59eb19004e54f910261a40d5e1b9e44b42 Use const in COutPoint class (Hennadii Stepanov) Pull request description: Refactoring: - all cases of using `(uint32_t) -1` in `COutPoint` class are replaced with const; - also all remaining instances of `(UNSIGNED)-1` transformed to `std::numeric_limits<UNSIGNED>::max()` (by @practicalswift). Tree-SHA512: fc7fe9838b6e5136d8b97ea3d6f64c4aaa1215f4369832df432cab017396620bb6e30520a64180ceab6de222562ac11eab243a78dfa5a658ba018835a34caa19
2018-12-06Include util/strencodings.h which is required for IsSpace(...)practicalswift
2018-12-04Use std::numeric_limits<UNSIGNED>::max()) instead of (UNSIGNED)-1practicalswift
2018-11-30Merge #13258: uint256: Remove unnecessary crypto/common.h dependencyWladimir J. van der Laan
bf2e01097 uint256: Remove unnecessary crypto/common.h use (Karl-Johan Alm) Pull request description: This is an alternative to #13242 which keeps the `ReadLE64` part, but moves the `crypto/common.h` dependency into `crypto/common.h` as a function outside of `uint256`. **Reason:** this change will remove dependencies for `uint256` to `crypto/common.h`, `compat/endian.h`, and `compat/byteswap.h`. This PR removes the need to update tests to be endian-aware/-independent, but keeps the (arguably dubious) `ReadLE64` part (which was only introduced to fix the tests, not for any functionality). Tree-SHA512: 78b35123cdb185b3b3ec59aba5ca8a5db72624d147f2d6a5484ffa5ce626a72f782a01dc6893fc8f5619b03e2eae7b5a03b0df5d43460f3bda428e719e188aec
2018-11-28Add comments to descriptor testsPieter Wuille
2018-11-28Add descriptor expansion cachePieter Wuille
2018-11-27Merge #14477: Add ability to convert solvability info to descriptorPieter Wuille
109699dd33 Add release notes (Pieter Wuille) b65326b562 Add matching descriptors to scantxoutset output + tests (Pieter Wuille) 16203d5df7 Add descriptors to listunspent and getaddressinfo + tests (Pieter Wuille) 9b2a25b13f Add tests for InferDescriptor and Descriptor::IsSolvable (Pieter Wuille) 225bf3e3b0 Add Descriptor::IsSolvable() to distinguish addr/raw from others (Pieter Wuille) 4d78bd93b5 Add support for inferring descriptors from scripts (Pieter Wuille) Pull request description: This PR adds functionality to convert a script to a descriptor, given a `SigningProvider` with the relevant information about public keys and redeemscripts/witnessscripts. The feature is exposed in `listunspent`, `getaddressinfo`, and `scantxoutset` whenever these calls are applied to solvable outputs/addresses. This is not very useful on its own, though when we add RPCs to import descriptors, or sign PSBTs using descriptors, these strings become a compact and standalone way of conveying everything necessary to sign an output (excluding private keys). Unit tests and rudimentary RPC tests are included (more relevant tests can be added once RPCs support descriptors). Fixes #14503. Tree-SHA512: cb36b84a3e0200375b7e06a98c7e750cfaf95cf5de132cad59f7ec3cbd201f739427de0dc108f515be7aca203652089fbf5f24ed283d4553bddf23a3224ab31f
2018-11-27Fix descriptor_tests not checking ToString output of public descriptorsRussell Yanofsky