Skip to content

Commit fa7e803

Browse files
author
MarcoFalke
committed
Remove unused MakeOptional
The only use was to work around a compiler warning in an ancient compiler, which we no longer support.
1 parent fadd402 commit fa7e803

File tree

3 files changed

+3
-12
lines changed

3 files changed

+3
-12
lines changed

src/optional.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,6 @@
1313
template <typename T>
1414
using Optional = boost::optional<T>;
1515

16-
//! Substitute for C++17 std::make_optional
17-
template <typename T>
18-
Optional<T> MakeOptional(bool condition, T&& value)
19-
{
20-
return boost::make_optional(condition, std::forward<T>(value));
21-
}
22-
2316
//! Substitute for C++17 std::nullopt
2417
static auto& nullopt = boost::none;
2518

src/wallet/rpcwallet.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1573,8 +1573,7 @@ static RPCHelpMan listsinceblock()
15731573

15741574
LOCK(wallet.cs_wallet);
15751575

1576-
// The way the 'height' is initialized is just a workaround for the gcc bug #47679 since version 4.6.0.
1577-
Optional<int> height = MakeOptional(false, int()); // Height of the specified block or the common ancestor, if the block provided was in a deactivated chain.
1576+
Optional<int> height; // Height of the specified block or the common ancestor, if the block provided was in a deactivated chain.
15781577
Optional<int> altheight; // Height of the specified block, even if it's in a deactivated chain.
15791578
int target_confirms = 1;
15801579
isminefilter filter = ISMINE_SPENDABLE;
@@ -3597,7 +3596,7 @@ static RPCHelpMan rescanblockchain()
35973596
}
35983597

35993598
int start_height = 0;
3600-
Optional<int> stop_height = MakeOptional(false, int());
3599+
Optional<int> stop_height;
36013600
uint256 start_block;
36023601
{
36033602
LOCK(pwallet->cs_wallet);

src/wallet/wallet.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4055,8 +4055,7 @@ std::shared_ptr<CWallet> CWallet::Create(interfaces::Chain& chain, const std::st
40554055

40564056
// No need to read and scan block if block was created before
40574057
// our wallet birthday (as adjusted for block time variability)
4058-
// The way the 'time_first_key' is initialized is just a workaround for the gcc bug #47679 since version 4.6.0.
4059-
Optional<int64_t> time_first_key = MakeOptional(false, int64_t());;
4058+
Optional<int64_t> time_first_key;
40604059
for (auto spk_man : walletInstance->GetAllScriptPubKeyMans()) {
40614060
int64_t time = spk_man->GetTimeFirstKey();
40624061
if (!time_first_key || time < *time_first_key) time_first_key = time;

0 commit comments

Comments
 (0)