From 57e980d13ca488031bde6ef197cf34d493d36796 Mon Sep 17 00:00:00 2001 From: fanquake Date: Mon, 15 Mar 2021 10:41:30 +0800 Subject: scripted-diff: remove Optional & nullopt -BEGIN VERIFY SCRIPT- git rm src/optional.h sed -i -e 's/Optional/d' src/test/fuzz/autofile.cpp src/test/fuzz/buffered_file.cpp src/test/fuzz/node_eviction.cpp sed -i -e 's/#include /#include /g' $(git grep -l '#include ' src) -END VERIFY SCRIPT- --- src/wallet/wallet.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'src/wallet/wallet.cpp') diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 58ab124061..ad1d04d084 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include #include #include @@ -84,10 +84,10 @@ bool RemoveWalletSetting(interfaces::Chain& chain, const std::string& wallet_nam static void UpdateWalletSetting(interfaces::Chain& chain, const std::string& wallet_name, - Optional load_on_startup, + std::optional load_on_startup, std::vector& warnings) { - if (load_on_startup == nullopt) return; + if (load_on_startup == std::nullopt) return; if (load_on_startup.value() && !AddWalletSetting(chain, wallet_name)) { warnings.emplace_back(Untranslated("Wallet load on startup setting could not be updated, so wallet may not be loaded next node startup.")); } else if (!load_on_startup.value() && !RemoveWalletSetting(chain, wallet_name)) { @@ -107,7 +107,7 @@ bool AddWallet(const std::shared_ptr& wallet) return true; } -bool RemoveWallet(const std::shared_ptr& wallet, Optional load_on_start, std::vector& warnings) +bool RemoveWallet(const std::shared_ptr& wallet, std::optional load_on_start, std::vector& warnings) { assert(wallet); @@ -127,7 +127,7 @@ bool RemoveWallet(const std::shared_ptr& wallet, Optional load_on return true; } -bool RemoveWallet(const std::shared_ptr& wallet, Optional load_on_start) +bool RemoveWallet(const std::shared_ptr& wallet, std::optional load_on_start) { std::vector warnings; return RemoveWallet(wallet, load_on_start, warnings); @@ -204,7 +204,7 @@ void UnloadWallet(std::shared_ptr&& wallet) } namespace { -std::shared_ptr LoadWalletInternal(interfaces::Chain& chain, const std::string& name, Optional load_on_start, const DatabaseOptions& options, DatabaseStatus& status, bilingual_str& error, std::vector& warnings) +std::shared_ptr LoadWalletInternal(interfaces::Chain& chain, const std::string& name, std::optional load_on_start, const DatabaseOptions& options, DatabaseStatus& status, bilingual_str& error, std::vector& warnings) { try { std::unique_ptr database = MakeWalletDatabase(name, options, status, error); @@ -234,7 +234,7 @@ std::shared_ptr LoadWalletInternal(interfaces::Chain& chain, const std: } } // namespace -std::shared_ptr LoadWallet(interfaces::Chain& chain, const std::string& name, Optional load_on_start, const DatabaseOptions& options, DatabaseStatus& status, bilingual_str& error, std::vector& warnings) +std::shared_ptr LoadWallet(interfaces::Chain& chain, const std::string& name, std::optional load_on_start, const DatabaseOptions& options, DatabaseStatus& status, bilingual_str& error, std::vector& warnings) { auto result = WITH_LOCK(g_loading_wallet_mutex, return g_loading_wallet_set.insert(name)); if (!result.second) { @@ -247,7 +247,7 @@ std::shared_ptr LoadWallet(interfaces::Chain& chain, const std::string& return wallet; } -std::shared_ptr CreateWallet(interfaces::Chain& chain, const std::string& name, Optional load_on_start, DatabaseOptions& options, DatabaseStatus& status, bilingual_str& error, std::vector& warnings) +std::shared_ptr CreateWallet(interfaces::Chain& chain, const std::string& name, std::optional load_on_start, DatabaseOptions& options, DatabaseStatus& status, bilingual_str& error, std::vector& warnings) { uint64_t wallet_creation_flags = options.create_flags; const SecureString& passphrase = options.create_passphrase; @@ -1763,7 +1763,7 @@ int64_t CWallet::RescanFromTime(int64_t startTime, const WalletRescanReserver& r * the main chain after to the addition of any new keys you want to detect * transactions for. */ -CWallet::ScanResult CWallet::ScanForWalletTransactions(const uint256& start_block, int start_height, Optional max_height, const WalletRescanReserver& reserver, bool fUpdate) +CWallet::ScanResult CWallet::ScanForWalletTransactions(const uint256& start_block, int start_height, std::optional max_height, const WalletRescanReserver& reserver, bool fUpdate) { int64_t nNow = GetTime(); int64_t start_time = GetTimeMillis(); @@ -2725,7 +2725,7 @@ static uint32_t GetLocktimeForNewTransaction(interfaces::Chain& chain, const uin return locktime; } -OutputType CWallet::TransactionChangeType(const Optional& change_type, const std::vector& vecSend) const +OutputType CWallet::TransactionChangeType(const std::optional& change_type, const std::vector& vecSend) const { // If -changetype is specified, always use that change type. if (change_type) { @@ -4067,13 +4067,13 @@ std::shared_ptr CWallet::Create(interfaces::Chain& chain, const std::st WalletBatch batch(walletInstance->GetDatabase()); CBlockLocator locator; if (batch.ReadBestBlock(locator)) { - if (const Optional fork_height = chain.findLocatorFork(locator)) { + if (const std::optional fork_height = chain.findLocatorFork(locator)) { rescan_height = *fork_height; } } } - const Optional tip_height = chain.getHeight(); + const std::optional tip_height = chain.getHeight(); if (tip_height) { walletInstance->m_last_block_processed = chain.getBlockHash(*tip_height); walletInstance->m_last_block_processed_height = *tip_height; @@ -4107,7 +4107,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) - Optional time_first_key; + std::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; -- cgit v1.2.3