diff options
author | Ben Woosley <ben.woosley@gmail.com> | 2019-01-31 10:46:23 -0800 |
---|---|---|
committer | Ben Woosley <ben.woosley@gmail.com> | 2019-01-31 22:10:55 -0800 |
commit | 267eac00f968850c859474434570ac8e1fce29f5 (patch) | |
tree | f475976fb2608b46a372e6e5b71e0cf9edc17c9c /src | |
parent | 1971f5ba04de9ac1e1a95d9f727e7bd4bc35dc88 (diff) |
Prefer boost::optional#get_value_or over #value_or
The latter is not defined in the earliest supported version of boost,
1.47.
https://www.boost.org/doc/libs/1_47_0/libs/optional/doc/html/boost_optional/detailed_semantics.html
https://travis-ci.org/bitcoin/bitcoin/jobs/486674823
Diffstat (limited to 'src')
-rw-r--r-- | src/interfaces/wallet.cpp | 4 | ||||
-rw-r--r-- | src/wallet/rpcdump.cpp | 2 | ||||
-rw-r--r-- | src/wallet/wallet.cpp | 6 |
3 files changed, 6 insertions, 6 deletions
diff --git a/src/interfaces/wallet.cpp b/src/interfaces/wallet.cpp index 62ede0a95a..a2cae2a7a7 100644 --- a/src/interfaces/wallet.cpp +++ b/src/interfaces/wallet.cpp @@ -353,7 +353,7 @@ public: LOCK(m_wallet.cs_wallet); auto mi = m_wallet.mapWallet.find(txid); if (mi != m_wallet.mapWallet.end()) { - num_blocks = locked_chain->getHeight().value_or(-1); + num_blocks = locked_chain->getHeight().get_value_or(-1); in_mempool = mi->second.InMempool(); order_form = mi->second.vOrderForm; tx_status = MakeWalletTxStatus(*locked_chain, mi->second); @@ -384,7 +384,7 @@ public: return false; } balances = getBalances(); - num_blocks = locked_chain->getHeight().value_or(-1); + num_blocks = locked_chain->getHeight().get_value_or(-1); return true; } CAmount getBalance() override { return m_wallet.GetBalance(); } diff --git a/src/wallet/rpcdump.cpp b/src/wallet/rpcdump.cpp index 2e62a6979f..0daaf94726 100644 --- a/src/wallet/rpcdump.cpp +++ b/src/wallet/rpcdump.cpp @@ -785,7 +785,7 @@ UniValue dumpwallet(const JSONRPCRequest& request) file << strprintf("# Wallet dump created by Bitcoin %s\n", CLIENT_BUILD); file << strprintf("# * Created on %s\n", FormatISO8601DateTime(GetTime())); const Optional<int> tip_height = locked_chain->getHeight(); - file << strprintf("# * Best block at time of backup was %i (%s),\n", tip_height.value_or(-1), tip_height ? locked_chain->getBlockHash(*tip_height).ToString() : "(missing block hash)"); + file << strprintf("# * Best block at time of backup was %i (%s),\n", tip_height.get_value_or(-1), tip_height ? locked_chain->getBlockHash(*tip_height).ToString() : "(missing block hash)"); file << strprintf("# mined on %s\n", tip_height ? FormatISO8601DateTime(locked_chain->getBlockTime(*tip_height)) : "(missing block time)"); file << "\n"; diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 5c379aacd6..3805f46e1a 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1717,10 +1717,10 @@ CWallet::ScanResult CWallet::ScanForWalletTransactions(const uint256& start_bloc } ShowProgress(strprintf("%s " + _("Rescanning..."), GetDisplayName()), 100); // hide progress dialog in GUI if (block_height && fAbortRescan) { - WalletLogPrintf("Rescan aborted at block %d. Progress=%f\n", block_height.value_or(0), progress_current); + WalletLogPrintf("Rescan aborted at block %d. Progress=%f\n", block_height.get_value_or(0), progress_current); result.status = ScanResult::USER_ABORT; } else if (block_height && ShutdownRequested()) { - WalletLogPrintf("Rescan interrupted by shutdown request at block %d. Progress=%f\n", block_height.value_or(0), progress_current); + WalletLogPrintf("Rescan interrupted by shutdown request at block %d. Progress=%f\n", block_height.get_value_or(0), progress_current); result.status = ScanResult::USER_ABORT; } } @@ -2581,7 +2581,7 @@ static bool IsCurrentForAntiFeeSniping(interfaces::Chain::Lock& locked_chain) */ static uint32_t GetLocktimeForNewTransaction(interfaces::Chain::Lock& locked_chain) { - uint32_t const height = locked_chain.getHeight().value_or(-1); + uint32_t const height = locked_chain.getHeight().get_value_or(-1); uint32_t locktime; // Discourage fee sniping. // |