Skip to content

Commit 267eac0

Browse files
committed
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
1 parent 1971f5b commit 267eac0

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/interfaces/wallet.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ class WalletImpl : public Wallet
353353
LOCK(m_wallet.cs_wallet);
354354
auto mi = m_wallet.mapWallet.find(txid);
355355
if (mi != m_wallet.mapWallet.end()) {
356-
num_blocks = locked_chain->getHeight().value_or(-1);
356+
num_blocks = locked_chain->getHeight().get_value_or(-1);
357357
in_mempool = mi->second.InMempool();
358358
order_form = mi->second.vOrderForm;
359359
tx_status = MakeWalletTxStatus(*locked_chain, mi->second);
@@ -384,7 +384,7 @@ class WalletImpl : public Wallet
384384
return false;
385385
}
386386
balances = getBalances();
387-
num_blocks = locked_chain->getHeight().value_or(-1);
387+
num_blocks = locked_chain->getHeight().get_value_or(-1);
388388
return true;
389389
}
390390
CAmount getBalance() override { return m_wallet.GetBalance(); }

src/wallet/rpcdump.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,7 @@ UniValue dumpwallet(const JSONRPCRequest& request)
785785
file << strprintf("# Wallet dump created by Bitcoin %s\n", CLIENT_BUILD);
786786
file << strprintf("# * Created on %s\n", FormatISO8601DateTime(GetTime()));
787787
const Optional<int> tip_height = locked_chain->getHeight();
788-
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)");
788+
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)");
789789
file << strprintf("# mined on %s\n", tip_height ? FormatISO8601DateTime(locked_chain->getBlockTime(*tip_height)) : "(missing block time)");
790790
file << "\n";
791791

src/wallet/wallet.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1717,10 +1717,10 @@ CWallet::ScanResult CWallet::ScanForWalletTransactions(const uint256& start_bloc
17171717
}
17181718
ShowProgress(strprintf("%s " + _("Rescanning..."), GetDisplayName()), 100); // hide progress dialog in GUI
17191719
if (block_height && fAbortRescan) {
1720-
WalletLogPrintf("Rescan aborted at block %d. Progress=%f\n", block_height.value_or(0), progress_current);
1720+
WalletLogPrintf("Rescan aborted at block %d. Progress=%f\n", block_height.get_value_or(0), progress_current);
17211721
result.status = ScanResult::USER_ABORT;
17221722
} else if (block_height && ShutdownRequested()) {
1723-
WalletLogPrintf("Rescan interrupted by shutdown request at block %d. Progress=%f\n", block_height.value_or(0), progress_current);
1723+
WalletLogPrintf("Rescan interrupted by shutdown request at block %d. Progress=%f\n", block_height.get_value_or(0), progress_current);
17241724
result.status = ScanResult::USER_ABORT;
17251725
}
17261726
}
@@ -2581,7 +2581,7 @@ static bool IsCurrentForAntiFeeSniping(interfaces::Chain::Lock& locked_chain)
25812581
*/
25822582
static uint32_t GetLocktimeForNewTransaction(interfaces::Chain::Lock& locked_chain)
25832583
{
2584-
uint32_t const height = locked_chain.getHeight().value_or(-1);
2584+
uint32_t const height = locked_chain.getHeight().get_value_or(-1);
25852585
uint32_t locktime;
25862586
// Discourage fee sniping.
25872587
//

0 commit comments

Comments
 (0)