From fa7e803f3e4df33117927aef6fef9bfaee4f410d Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Wed, 16 Dec 2020 12:02:27 +0100 Subject: [PATCH] Remove unused MakeOptional The only use was to work around a compiler warning in an ancient compiler, which we no longer support. --- src/optional.h | 7 ------- src/wallet/rpcwallet.cpp | 5 ++--- src/wallet/wallet.cpp | 3 +-- 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/src/optional.h b/src/optional.h index a382cd7b77..252d56fd58 100644 --- a/src/optional.h +++ b/src/optional.h @@ -13,13 +13,6 @@ template using Optional = boost::optional; -//! Substitute for C++17 std::make_optional -template -Optional MakeOptional(bool condition, T&& value) -{ - return boost::make_optional(condition, std::forward(value)); -} - //! Substitute for C++17 std::nullopt static auto& nullopt = boost::none; diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 94a73b67df..614ebd22f6 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -1573,8 +1573,7 @@ static RPCHelpMan listsinceblock() LOCK(wallet.cs_wallet); - // The way the 'height' is initialized is just a workaround for the gcc bug #47679 since version 4.6.0. - Optional height = MakeOptional(false, int()); // Height of the specified block or the common ancestor, if the block provided was in a deactivated chain. + Optional height; // Height of the specified block or the common ancestor, if the block provided was in a deactivated chain. Optional altheight; // Height of the specified block, even if it's in a deactivated chain. int target_confirms = 1; isminefilter filter = ISMINE_SPENDABLE; @@ -3597,7 +3596,7 @@ static RPCHelpMan rescanblockchain() } int start_height = 0; - Optional stop_height = MakeOptional(false, int()); + Optional stop_height; uint256 start_block; { LOCK(pwallet->cs_wallet); diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 740e671595..e8a67ede2b 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -4055,8 +4055,7 @@ std::shared_ptr CWallet::Create(interfaces::Chain& chain, const std::st // No need to read and scan block if block was created before // our wallet birthday (as adjusted for block time variability) - // The way the 'time_first_key' is initialized is just a workaround for the gcc bug #47679 since version 4.6.0. - Optional time_first_key = MakeOptional(false, int64_t());; + Optional time_first_key; for (auto spk_man : walletInstance->GetAllScriptPubKeyMans()) { int64_t time = spk_man->GetTimeFirstKey(); if (!time_first_key || time < *time_first_key) time_first_key = time;