aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>2024-08-02 11:36:42 +0200
committerMarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>2024-08-21 23:27:54 +0200
commitfab023e177d7eaef73902869ae1c95693f1e268b (patch)
tree98003778de9ac4d43223ca7ef2c734a58927a9ed /src
parentfa2cb654eca8dd6ed89101cd6d199ba1de0b81e0 (diff)
downloadbitcoin-fab023e177d7eaef73902869ae1c95693f1e268b.tar.xz
test: refactor: Make unsigned promotion explicit
Integer promotion will already turn the `signed` into `unsigned` in those lines. However, make the `unsigned` explicit so that the code is clearer and a compiler warning is avoided when switching to m_rng: | test/validation_block_tests.cpp: warning: comparison of integers of different signs: 'int' and 'const unsigned int' [-Wsign-compare] | 136 | bool gen_invalid = m_rng.randrange(100) < invalid_rate; | | ~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~ | 137 | bool gen_fork = m_rng.randrange(100) < branch_rate; | | ~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~ | 2 warnings generated.
Diffstat (limited to 'src')
-rw-r--r--src/test/validation_block_tests.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/test/validation_block_tests.cpp b/src/test/validation_block_tests.cpp
index 588ac60498..015a5941ed 100644
--- a/src/test/validation_block_tests.cpp
+++ b/src/test/validation_block_tests.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2018-2022 The Bitcoin Core developers
+// Copyright (c) 2018-present The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
@@ -133,8 +133,8 @@ void MinerTestingSetup::BuildChain(const uint256& root, int height, const unsign
{
if (height <= 0 || blocks.size() >= max_size) return;
- bool gen_invalid = InsecureRandRange(100) < invalid_rate;
- bool gen_fork = InsecureRandRange(100) < branch_rate;
+ bool gen_invalid = m_rng.randrange(100U) < invalid_rate;
+ bool gen_fork = m_rng.randrange(100U) < branch_rate;
const std::shared_ptr<const CBlock> pblock = gen_invalid ? BadBlock(root) : GoodBlock(root);
blocks.push_back(pblock);