diff --git a/src/masternodes/masternodes.cpp b/src/masternodes/masternodes.cpp index 86b528af9c0..54d3bfe8755 100644 --- a/src/masternodes/masternodes.cpp +++ b/src/masternodes/masternodes.cpp @@ -922,16 +922,16 @@ CAmount CCollateralLoans::precisionRatio() const ResVal CCustomCSView::GetAmountInCurrency(CAmount amount, CTokenCurrencyPair priceFeedId, bool useNextPrice, bool requireLivePrice) { - auto priceResult = GetValidatedIntervalPrice(priceFeedId, useNextPrice, requireLivePrice); - if (!priceResult) - return std::move(priceResult); + auto priceResult = GetValidatedIntervalPrice(priceFeedId, useNextPrice, requireLivePrice); + if (!priceResult) + return priceResult; - auto price = priceResult.val.get(); - auto amountInCurrency = MultiplyAmounts(price, amount); - if (price > COIN && amountInCurrency < amount) - return Res::Err("Value/price too high (%s/%s)", GetDecimaleString(amount), GetDecimaleString(price)); + auto price = *priceResult.val; + auto amountInCurrency = MultiplyAmounts(price, amount); + if (price > COIN && amountInCurrency < amount) + return Res::Err("Value/price too high (%s/%s)", GetDecimaleString(amount), GetDecimaleString(price)); - return ResVal(amountInCurrency, Res::Ok()); + return ResVal(amountInCurrency, Res::Ok()); } ResVal CCustomCSView::GetLoanCollaterals(CVaultId const& vaultId, CBalances const& collaterals, uint32_t height,