aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bench/coin_selection.cpp6
-rw-r--r--src/crypto/siphash.cpp6
-rw-r--r--src/cuckoocache.h2
-rw-r--r--src/random.h2
-rw-r--r--src/script/interpreter.cpp2
-rw-r--r--src/test/checkqueue_tests.cpp4
-rw-r--r--src/test/crypto_tests.cpp4
-rw-r--r--src/test/fuzz/p2p_transport_serialization.cpp2
-rw-r--r--src/test/fuzz/versionbits.cpp2
-rw-r--r--src/test/merkle_tests.cpp10
-rw-r--r--src/test/random_tests.cpp2
-rw-r--r--src/test/serialize_tests.cpp12
-rw-r--r--src/test/streams_tests.cpp4
-rw-r--r--src/test/util_tests.cpp8
-rw-r--r--src/test/validation_chainstate_tests.cpp2
-rw-r--r--src/test/validation_flush_tests.cpp2
-rw-r--r--src/util/moneystr.cpp2
-rw-r--r--src/versionbits.cpp2
-rw-r--r--src/wallet/bdb.cpp2
-rw-r--r--src/wallet/scriptpubkeyman.cpp2
-rw-r--r--src/wallet/spend.cpp2
-rw-r--r--src/wallet/test/coinselector_tests.cpp6
-rw-r--r--src/wallet/test/wallet_tests.cpp8
23 files changed, 47 insertions, 47 deletions
diff --git a/src/bench/coin_selection.cpp b/src/bench/coin_selection.cpp
index d02ddff37d..087e1442fe 100644
--- a/src/bench/coin_selection.cpp
+++ b/src/bench/coin_selection.cpp
@@ -99,9 +99,9 @@ static CAmount make_hard_case(int utxos, std::vector<OutputGroup>& utxo_pool)
utxo_pool.clear();
CAmount target = 0;
for (int i = 0; i < utxos; ++i) {
- target += (CAmount)1 << (utxos+i);
- add_coin((CAmount)1 << (utxos+i), 2*i, utxo_pool);
- add_coin(((CAmount)1 << (utxos+i)) + ((CAmount)1 << (utxos-1-i)), 2*i + 1, utxo_pool);
+ target += CAmount{1} << (utxos+i);
+ add_coin(CAmount{1} << (utxos+i), 2*i, utxo_pool);
+ add_coin((CAmount{1} << (utxos+i)) + (CAmount{1} << (utxos-1-i)), 2*i + 1, utxo_pool);
}
return target;
}
diff --git a/src/crypto/siphash.cpp b/src/crypto/siphash.cpp
index 2e90c393e1..2f7555d02e 100644
--- a/src/crypto/siphash.cpp
+++ b/src/crypto/siphash.cpp
@@ -119,10 +119,10 @@ uint64_t SipHashUint256(uint64_t k0, uint64_t k1, const uint256& val)
SIPROUND;
SIPROUND;
v0 ^= d;
- v3 ^= ((uint64_t)4) << 59;
+ v3 ^= (uint64_t{4}) << 59;
SIPROUND;
SIPROUND;
- v0 ^= ((uint64_t)4) << 59;
+ v0 ^= (uint64_t{4}) << 59;
v2 ^= 0xFF;
SIPROUND;
SIPROUND;
@@ -159,7 +159,7 @@ uint64_t SipHashUint256Extra(uint64_t k0, uint64_t k1, const uint256& val, uint3
SIPROUND;
SIPROUND;
v0 ^= d;
- d = (((uint64_t)36) << 56) | extra;
+ d = ((uint64_t{36}) << 56) | extra;
v3 ^= d;
SIPROUND;
SIPROUND;
diff --git a/src/cuckoocache.h b/src/cuckoocache.h
index 61f553806e..6adcc74516 100644
--- a/src/cuckoocache.h
+++ b/src/cuckoocache.h
@@ -344,7 +344,7 @@ public:
collection_flags.setup(size);
epoch_flags.resize(size);
// Set to 45% as described above
- epoch_size = std::max((uint32_t)1, (45 * size) / 100);
+ epoch_size = std::max(uint32_t{1}, (45 * size) / 100);
// Initially set to wait for a whole epoch
epoch_heuristic_counter = epoch_size;
return size;
diff --git a/src/random.h b/src/random.h
index 911aac08ca..6223da0377 100644
--- a/src/random.h
+++ b/src/random.h
@@ -200,7 +200,7 @@ public:
return rand64() >> (64 - bits);
} else {
if (bitbuf_size < bits) FillBitBuffer();
- uint64_t ret = bitbuf & (~(uint64_t)0 >> (64 - bits));
+ uint64_t ret = bitbuf & (~uint64_t{0} >> (64 - bits));
bitbuf >>= bits;
bitbuf_size -= bits;
return ret;
diff --git a/src/script/interpreter.cpp b/src/script/interpreter.cpp
index b15fc2a576..a942ff349b 100644
--- a/src/script/interpreter.cpp
+++ b/src/script/interpreter.cpp
@@ -1303,7 +1303,7 @@ public:
// Serialize the nSequence
if (nInput != nIn && (fHashSingle || fHashNone))
// let the others update at will
- ::Serialize(s, (int)0);
+ ::Serialize(s, int{0});
else
::Serialize(s, txTo.vin[nInput].nSequence);
}
diff --git a/src/test/checkqueue_tests.cpp b/src/test/checkqueue_tests.cpp
index faf6055b67..53fbc26e15 100644
--- a/src/test/checkqueue_tests.cpp
+++ b/src/test/checkqueue_tests.cpp
@@ -194,7 +194,7 @@ static void Correct_Queue_range(std::vector<size_t> range)
BOOST_AUTO_TEST_CASE(test_CheckQueue_Correct_Zero)
{
std::vector<size_t> range;
- range.push_back((size_t)0);
+ range.push_back(size_t{0});
Correct_Queue_range(range);
}
/** Test that 1 check is correct
@@ -202,7 +202,7 @@ BOOST_AUTO_TEST_CASE(test_CheckQueue_Correct_Zero)
BOOST_AUTO_TEST_CASE(test_CheckQueue_Correct_One)
{
std::vector<size_t> range;
- range.push_back((size_t)1);
+ range.push_back(size_t{1});
Correct_Queue_range(range);
}
/** Test that MAX check is correct
diff --git a/src/test/crypto_tests.cpp b/src/test/crypto_tests.cpp
index 6148edf115..9b369a5c50 100644
--- a/src/test/crypto_tests.cpp
+++ b/src/test/crypto_tests.cpp
@@ -723,14 +723,14 @@ BOOST_AUTO_TEST_CASE(countbits_tests)
// Check handling of zero.
BOOST_CHECK_EQUAL(CountBits(0), 0U);
} else if (i < 10) {
- for (uint64_t j = (uint64_t)1 << (i - 1); (j >> i) == 0; ++j) {
+ for (uint64_t j = uint64_t{1} << (i - 1); (j >> i) == 0; ++j) {
// Exhaustively test up to 10 bits
BOOST_CHECK_EQUAL(CountBits(j), i);
}
} else {
for (int k = 0; k < 1000; k++) {
// Randomly test 1000 samples of each length above 10 bits.
- uint64_t j = ((uint64_t)1) << (i - 1) | ctx.randbits(i - 1);
+ uint64_t j = (uint64_t{1}) << (i - 1) | ctx.randbits(i - 1);
BOOST_CHECK_EQUAL(CountBits(j), i);
}
}
diff --git a/src/test/fuzz/p2p_transport_serialization.cpp b/src/test/fuzz/p2p_transport_serialization.cpp
index 3eb370a858..96254aa222 100644
--- a/src/test/fuzz/p2p_transport_serialization.cpp
+++ b/src/test/fuzz/p2p_transport_serialization.cpp
@@ -24,7 +24,7 @@ void initialize_p2p_transport_serialization()
FUZZ_TARGET_INIT(p2p_transport_serialization, initialize_p2p_transport_serialization)
{
// Construct deserializer, with a dummy NodeId
- V1TransportDeserializer deserializer{Params(), (NodeId)0, SER_NETWORK, INIT_PROTO_VERSION};
+ V1TransportDeserializer deserializer{Params(), NodeId{0}, SER_NETWORK, INIT_PROTO_VERSION};
V1TransportSerializer serializer{};
FuzzedDataProvider fuzzed_data_provider{buffer.data(), buffer.size()};
diff --git a/src/test/fuzz/versionbits.cpp b/src/test/fuzz/versionbits.cpp
index 95eb71099d..143027662f 100644
--- a/src/test/fuzz/versionbits.cpp
+++ b/src/test/fuzz/versionbits.cpp
@@ -55,7 +55,7 @@ public:
bool Condition(int32_t version) const
{
- uint32_t mask = ((uint32_t)1) << m_bit;
+ uint32_t mask = (uint32_t{1}) << m_bit;
return (((version & VERSIONBITS_TOP_MASK) == VERSIONBITS_TOP_BITS) && (version & mask) != 0);
}
diff --git a/src/test/merkle_tests.cpp b/src/test/merkle_tests.cpp
index 942d54ede8..bba103d1b0 100644
--- a/src/test/merkle_tests.cpp
+++ b/src/test/merkle_tests.cpp
@@ -50,7 +50,7 @@ static void MerkleComputation(const std::vector<uint256>& leaves, uint256* proot
// For each of the lower bits in count that are 0, do 1 step. Each
// corresponds to an inner value that existed before processing the
// current leaf, and each needs a hash to combine it.
- for (level = 0; !(count & (((uint32_t)1) << level)); level++) {
+ for (level = 0; !(count & ((uint32_t{1}) << level)); level++) {
if (pbranch) {
if (matchh) {
pbranch->push_back(inner[level]);
@@ -74,12 +74,12 @@ static void MerkleComputation(const std::vector<uint256>& leaves, uint256* proot
int level = 0;
// As long as bit number level in count is zero, skip it. It means there
// is nothing left at this level.
- while (!(count & (((uint32_t)1) << level))) {
+ while (!(count & ((uint32_t{1}) << level))) {
level++;
}
uint256 h = inner[level];
bool matchh = matchlevel == level;
- while (count != (((uint32_t)1) << level)) {
+ while (count != ((uint32_t{1}) << level)) {
// If we reach this point, h is an inner value that is not the top.
// We combine it with itself (Bitcoin's special rule for odd levels in
// the tree) to produce a higher level one.
@@ -89,10 +89,10 @@ static void MerkleComputation(const std::vector<uint256>& leaves, uint256* proot
CHash256().Write(h).Write(h).Finalize(h);
// Increment count to the value it would have if two entries at this
// level had existed.
- count += (((uint32_t)1) << level);
+ count += ((uint32_t{1}) << level);
level++;
// And propagate the result upwards accordingly.
- while (!(count & (((uint32_t)1) << level))) {
+ while (!(count & ((uint32_t{1}) << level))) {
if (pbranch) {
if (matchh) {
pbranch->push_back(inner[level]);
diff --git a/src/test/random_tests.cpp b/src/test/random_tests.cpp
index 54d5ab6794..db659af0b8 100644
--- a/src/test/random_tests.cpp
+++ b/src/test/random_tests.cpp
@@ -94,7 +94,7 @@ BOOST_AUTO_TEST_CASE(fastrandom_randbits)
for (int j = 0; j < 1000; ++j) {
uint64_t rangebits = ctx1.randbits(bits);
BOOST_CHECK_EQUAL(rangebits >> bits, 0U);
- uint64_t range = ((uint64_t)1) << bits | rangebits;
+ uint64_t range = (uint64_t{1}) << bits | rangebits;
uint64_t rand = ctx2.randrange(range);
BOOST_CHECK(rand < range);
}
diff --git a/src/test/serialize_tests.cpp b/src/test/serialize_tests.cpp
index 5f8e353dd6..c90ae38ae8 100644
--- a/src/test/serialize_tests.cpp
+++ b/src/test/serialize_tests.cpp
@@ -123,17 +123,17 @@ BOOST_AUTO_TEST_CASE(varints_bitpatterns)
CDataStream ss(SER_DISK, 0);
ss << VARINT_MODE(0, VarIntMode::NONNEGATIVE_SIGNED); BOOST_CHECK_EQUAL(HexStr(ss), "00"); ss.clear();
ss << VARINT_MODE(0x7f, VarIntMode::NONNEGATIVE_SIGNED); BOOST_CHECK_EQUAL(HexStr(ss), "7f"); ss.clear();
- ss << VARINT_MODE((int8_t)0x7f, VarIntMode::NONNEGATIVE_SIGNED); BOOST_CHECK_EQUAL(HexStr(ss), "7f"); ss.clear();
+ ss << VARINT_MODE(int8_t{0x7f}, VarIntMode::NONNEGATIVE_SIGNED); BOOST_CHECK_EQUAL(HexStr(ss), "7f"); ss.clear();
ss << VARINT_MODE(0x80, VarIntMode::NONNEGATIVE_SIGNED); BOOST_CHECK_EQUAL(HexStr(ss), "8000"); ss.clear();
- ss << VARINT((uint8_t)0x80); BOOST_CHECK_EQUAL(HexStr(ss), "8000"); ss.clear();
+ ss << VARINT(uint8_t{0x80}); BOOST_CHECK_EQUAL(HexStr(ss), "8000"); ss.clear();
ss << VARINT_MODE(0x1234, VarIntMode::NONNEGATIVE_SIGNED); BOOST_CHECK_EQUAL(HexStr(ss), "a334"); ss.clear();
- ss << VARINT_MODE((int16_t)0x1234, VarIntMode::NONNEGATIVE_SIGNED); BOOST_CHECK_EQUAL(HexStr(ss), "a334"); ss.clear();
+ ss << VARINT_MODE(int16_t{0x1234}, VarIntMode::NONNEGATIVE_SIGNED); BOOST_CHECK_EQUAL(HexStr(ss), "a334"); ss.clear();
ss << VARINT_MODE(0xffff, VarIntMode::NONNEGATIVE_SIGNED); BOOST_CHECK_EQUAL(HexStr(ss), "82fe7f"); ss.clear();
- ss << VARINT((uint16_t)0xffff); BOOST_CHECK_EQUAL(HexStr(ss), "82fe7f"); ss.clear();
+ ss << VARINT(uint16_t{0xffff}); BOOST_CHECK_EQUAL(HexStr(ss), "82fe7f"); ss.clear();
ss << VARINT_MODE(0x123456, VarIntMode::NONNEGATIVE_SIGNED); BOOST_CHECK_EQUAL(HexStr(ss), "c7e756"); ss.clear();
- ss << VARINT_MODE((int32_t)0x123456, VarIntMode::NONNEGATIVE_SIGNED); BOOST_CHECK_EQUAL(HexStr(ss), "c7e756"); ss.clear();
+ ss << VARINT_MODE(int32_t{0x123456}, VarIntMode::NONNEGATIVE_SIGNED); BOOST_CHECK_EQUAL(HexStr(ss), "c7e756"); ss.clear();
ss << VARINT(0x80123456U); BOOST_CHECK_EQUAL(HexStr(ss), "86ffc7e756"); ss.clear();
- ss << VARINT((uint32_t)0x80123456U); BOOST_CHECK_EQUAL(HexStr(ss), "86ffc7e756"); ss.clear();
+ ss << VARINT(uint32_t{0x80123456U}); BOOST_CHECK_EQUAL(HexStr(ss), "86ffc7e756"); ss.clear();
ss << VARINT(0xffffffff); BOOST_CHECK_EQUAL(HexStr(ss), "8efefefe7f"); ss.clear();
ss << VARINT_MODE(0x7fffffffffffffffLL, VarIntMode::NONNEGATIVE_SIGNED); BOOST_CHECK_EQUAL(HexStr(ss), "fefefefefefefefe7f"); ss.clear();
ss << VARINT(0xffffffffffffffffULL); BOOST_CHECK_EQUAL(HexStr(ss), "80fefefefefefefefe7f"); ss.clear();
diff --git a/src/test/streams_tests.cpp b/src/test/streams_tests.cpp
index c4be3a4129..dce230ac10 100644
--- a/src/test/streams_tests.cpp
+++ b/src/test/streams_tests.cpp
@@ -144,10 +144,10 @@ BOOST_AUTO_TEST_CASE(bitstream_reader_writer)
CDataStream data_copy(data);
uint32_t serialized_int1;
data >> serialized_int1;
- BOOST_CHECK_EQUAL(serialized_int1, (uint32_t)0x7700C35A); // NOTE: Serialized as LE
+ BOOST_CHECK_EQUAL(serialized_int1, uint32_t{0x7700C35A}); // NOTE: Serialized as LE
uint16_t serialized_int2;
data >> serialized_int2;
- BOOST_CHECK_EQUAL(serialized_int2, (uint16_t)0x1072); // NOTE: Serialized as LE
+ BOOST_CHECK_EQUAL(serialized_int2, uint16_t{0x1072}); // NOTE: Serialized as LE
BitStreamReader<CDataStream> bit_reader(data_copy);
BOOST_CHECK_EQUAL(bit_reader.Read(1), 0U);
diff --git a/src/test/util_tests.cpp b/src/test/util_tests.cpp
index 4d04c076e3..6b6bb18523 100644
--- a/src/test/util_tests.cpp
+++ b/src/test/util_tests.cpp
@@ -810,8 +810,8 @@ BOOST_AUTO_TEST_CASE(test_ParseInt64)
BOOST_CHECK(ParseInt64("01234", &n) && n == 1234LL); // no octal
BOOST_CHECK(ParseInt64("2147483647", &n) && n == 2147483647LL);
BOOST_CHECK(ParseInt64("-2147483648", &n) && n == -2147483648LL);
- BOOST_CHECK(ParseInt64("9223372036854775807", &n) && n == (int64_t)9223372036854775807);
- BOOST_CHECK(ParseInt64("-9223372036854775808", &n) && n == (int64_t)-9223372036854775807-1);
+ BOOST_CHECK(ParseInt64("9223372036854775807", &n) && n == int64_t{9223372036854775807});
+ BOOST_CHECK(ParseInt64("-9223372036854775808", &n) && n == int64_t{-9223372036854775807-1});
BOOST_CHECK(ParseInt64("-1234", &n) && n == -1234LL);
// Invalid values
BOOST_CHECK(!ParseInt64("", &n));
@@ -907,8 +907,8 @@ BOOST_AUTO_TEST_CASE(test_ParseUInt32)
BOOST_CHECK(ParseUInt32("1234", &n) && n == 1234);
BOOST_CHECK(ParseUInt32("01234", &n) && n == 1234); // no octal
BOOST_CHECK(ParseUInt32("2147483647", &n) && n == 2147483647);
- BOOST_CHECK(ParseUInt32("2147483648", &n) && n == (uint32_t)2147483648);
- BOOST_CHECK(ParseUInt32("4294967295", &n) && n == (uint32_t)4294967295);
+ BOOST_CHECK(ParseUInt32("2147483648", &n) && n == uint32_t{2147483648});
+ BOOST_CHECK(ParseUInt32("4294967295", &n) && n == uint32_t{4294967295});
BOOST_CHECK(ParseUInt32("+1234", &n) && n == 1234);
BOOST_CHECK(ParseUInt32("00000000000000001234", &n) && n == 1234);
BOOST_CHECK(ParseUInt32("00000000000000000000", &n) && n == 0);
diff --git a/src/test/validation_chainstate_tests.cpp b/src/test/validation_chainstate_tests.cpp
index c0d59d6136..c40481a95c 100644
--- a/src/test/validation_chainstate_tests.cpp
+++ b/src/test/validation_chainstate_tests.cpp
@@ -32,7 +32,7 @@ BOOST_AUTO_TEST_CASE(validation_chainstate_resize_caches)
COutPoint outp{txid, 0};
newcoin.nHeight = 1;
newcoin.out.nValue = InsecureRand32();
- newcoin.out.scriptPubKey.assign((uint32_t)56, 1);
+ newcoin.out.scriptPubKey.assign(uint32_t{56}, 1);
coins_view.AddCoin(outp, std::move(newcoin), false);
return outp;
diff --git a/src/test/validation_flush_tests.cpp b/src/test/validation_flush_tests.cpp
index a006d715cc..f2ff570ca6 100644
--- a/src/test/validation_flush_tests.cpp
+++ b/src/test/validation_flush_tests.cpp
@@ -31,7 +31,7 @@ BOOST_AUTO_TEST_CASE(getcoinscachesizestate)
COutPoint outp{txid, 0};
newcoin.nHeight = 1;
newcoin.out.nValue = InsecureRand32();
- newcoin.out.scriptPubKey.assign((uint32_t)56, 1);
+ newcoin.out.scriptPubKey.assign(uint32_t{56}, 1);
coins_view.AddCoin(outp, std::move(newcoin), false);
return outp;
diff --git a/src/util/moneystr.cpp b/src/util/moneystr.cpp
index 9ecc899d0c..9181329afc 100644
--- a/src/util/moneystr.cpp
+++ b/src/util/moneystr.cpp
@@ -34,7 +34,7 @@ std::string FormatMoney(const CAmount n)
str.erase(str.size()-nTrim, nTrim);
if (n < 0)
- str.insert((unsigned int)0, 1, '-');
+ str.insert(uint32_t{0}, 1, '-');
return str;
}
diff --git a/src/versionbits.cpp b/src/versionbits.cpp
index 8463704e7c..fa9d1fe9c9 100644
--- a/src/versionbits.cpp
+++ b/src/versionbits.cpp
@@ -195,7 +195,7 @@ protected:
public:
explicit VersionBitsConditionChecker(Consensus::DeploymentPos id_) : id(id_) {}
- uint32_t Mask(const Consensus::Params& params) const { return ((uint32_t)1) << params.vDeployments[id].bit; }
+ uint32_t Mask(const Consensus::Params& params) const { return (uint32_t{1}) << params.vDeployments[id].bit; }
};
} // namespace
diff --git a/src/wallet/bdb.cpp b/src/wallet/bdb.cpp
index 06650a73cc..4ec3ac2189 100644
--- a/src/wallet/bdb.cpp
+++ b/src/wallet/bdb.cpp
@@ -100,7 +100,7 @@ void BerkeleyEnvironment::Close()
if (ret != 0)
LogPrintf("BerkeleyEnvironment::Close: Error %d closing database environment: %s\n", ret, DbEnv::strerror(ret));
if (!fMockDb)
- DbEnv((uint32_t)0).remove(strPath.c_str(), 0);
+ DbEnv(uint32_t{0}).remove(strPath.c_str(), 0);
if (error_file) fclose(error_file);
diff --git a/src/wallet/scriptpubkeyman.cpp b/src/wallet/scriptpubkeyman.cpp
index fbb52ea621..d8f34dd2b0 100644
--- a/src/wallet/scriptpubkeyman.cpp
+++ b/src/wallet/scriptpubkeyman.cpp
@@ -2123,7 +2123,7 @@ bool DescriptorScriptPubKeyMan::TopUp(unsigned int size)
if (size > 0) {
target_size = size;
} else {
- target_size = std::max(gArgs.GetIntArg("-keypool", DEFAULT_KEYPOOL_SIZE), (int64_t) 1);
+ target_size = std::max(gArgs.GetIntArg("-keypool", DEFAULT_KEYPOOL_SIZE), int64_t{1});
}
// Calculate the new range_end
diff --git a/src/wallet/spend.cpp b/src/wallet/spend.cpp
index 0ec9e5411a..8bb970936b 100644
--- a/src/wallet/spend.cpp
+++ b/src/wallet/spend.cpp
@@ -667,7 +667,7 @@ util::Result<SelectionResult> AutomaticCoinSelection(const CWallet& wallet, Coin
// possible) if we cannot fund the transaction otherwise.
if (wallet.m_spend_zero_conf_change) {
ordered_filters.push_back({CoinEligibilityFilter(0, 1, 2)});
- ordered_filters.push_back({CoinEligibilityFilter(0, 1, std::min((size_t)4, max_ancestors/3), std::min((size_t)4, max_descendants/3))});
+ ordered_filters.push_back({CoinEligibilityFilter(0, 1, std::min(size_t{4}, max_ancestors/3), std::min(size_t{4}, max_descendants/3))});
ordered_filters.push_back({CoinEligibilityFilter(0, 1, max_ancestors/2, max_descendants/2)});
// If partial groups are allowed, relax the requirement of spending OutputGroups (groups
// of UTXOs sent to the same address, which are obviously controlled by a single wallet)
diff --git a/src/wallet/test/coinselector_tests.cpp b/src/wallet/test/coinselector_tests.cpp
index ae6d1deb8f..9de4fce121 100644
--- a/src/wallet/test/coinselector_tests.cpp
+++ b/src/wallet/test/coinselector_tests.cpp
@@ -121,9 +121,9 @@ static CAmount make_hard_case(int utxos, std::vector<COutput>& utxo_pool)
utxo_pool.clear();
CAmount target = 0;
for (int i = 0; i < utxos; ++i) {
- target += (CAmount)1 << (utxos+i);
- add_coin((CAmount)1 << (utxos+i), 2*i, utxo_pool);
- add_coin(((CAmount)1 << (utxos+i)) + ((CAmount)1 << (utxos-1-i)), 2*i + 1, utxo_pool);
+ target += CAmount{1} << (utxos+i);
+ add_coin(CAmount{1} << (utxos+i), 2*i, utxo_pool);
+ add_coin((CAmount{1} << (utxos+i)) + (CAmount{1} << (utxos-1-i)), 2*i + 1, utxo_pool);
}
return target;
}
diff --git a/src/wallet/test/wallet_tests.cpp b/src/wallet/test/wallet_tests.cpp
index c7c0a637de..8114b33673 100644
--- a/src/wallet/test/wallet_tests.cpp
+++ b/src/wallet/test/wallet_tests.cpp
@@ -736,10 +736,10 @@ BOOST_FIXTURE_TEST_CASE(wallet_descriptor_test, BasicTestingSetup)
std::vector<unsigned char> malformed_record;
CVectorWriter vw(0, 0, malformed_record, 0);
vw << std::string("notadescriptor");
- vw << (uint64_t)0;
- vw << (int32_t)0;
- vw << (int32_t)0;
- vw << (int32_t)1;
+ vw << uint64_t{0};
+ vw << int32_t{0};
+ vw << int32_t{0};
+ vw << int32_t{1};
SpanReader vr{0, 0, malformed_record};
WalletDescriptor w_desc;