diff --git a/include/xrpl/protocol/STObject.h b/include/xrpl/protocol/STObject.h index 359f7fa368..1a553e0fbf 100644 --- a/include/xrpl/protocol/STObject.h +++ b/include/xrpl/protocol/STObject.h @@ -482,6 +482,8 @@ public: value_type operator*() const; + /// Do not use operator->() unless the field is required, or you've checked + /// that it's set. T const* operator->() const; @@ -739,6 +741,8 @@ STObject::Proxy::operator*() const -> value_type return this->value(); } +/// Do not use operator->() unless the field is required, or you've checked that +/// it's set. template T const* STObject::Proxy::operator->() const diff --git a/src/xrpld/app/tx/detail/LoanManage.cpp b/src/xrpld/app/tx/detail/LoanManage.cpp index 4d20a3f6f0..75d7b9552c 100644 --- a/src/xrpld/app/tx/detail/LoanManage.cpp +++ b/src/xrpld/app/tx/detail/LoanManage.cpp @@ -175,7 +175,7 @@ LoanManage::defaultLoan( // The vault may be at a different scale than the loan. Reduce rounding // errors during the accounting by rounding some of the values to that // scale. - auto const vaultScale = vaultTotalProxy->value().exponent(); + auto const vaultScale = vaultTotalProxy.value().exponent(); if (vaultTotalProxy < vaultDefaultAmount) { @@ -197,13 +197,12 @@ LoanManage::defaultLoan( auto const difference = vaultAvailableProxy - vaultTotalProxy; JLOG(j.debug()) << "Vault assets available: " << *vaultAvailableProxy << "(" - << vaultAvailableProxy->value().exponent() + << vaultAvailableProxy.value().exponent() << "), Total: " << *vaultTotalProxy << "(" - << vaultTotalProxy->value().exponent() + << vaultTotalProxy.value().exponent() << "), Difference: " << difference << "(" << difference.exponent() << ")"; - if (vaultAvailableProxy->value().exponent() - - difference.exponent() > + if (vaultAvailableProxy.value().exponent() - difference.exponent() > 13) { // If the difference is dust, bring the total up to match diff --git a/src/xrpld/app/tx/detail/LoanPay.cpp b/src/xrpld/app/tx/detail/LoanPay.cpp index 096cc1b276..d99d2f4544 100644 --- a/src/xrpld/app/tx/detail/LoanPay.cpp +++ b/src/xrpld/app/tx/detail/LoanPay.cpp @@ -351,7 +351,7 @@ LoanPay::doApply() // The vault may be at a different scale than the loan. Reduce rounding // errors during the payment by rounding some of the values to that scale. - auto const vaultScale = assetsTotalProxy->value().exponent(); + auto const vaultScale = assetsTotalProxy.value().exponent(); auto const totalPaidToVaultRaw = paymentParts->principalPaid + paymentParts->interestPaid; diff --git a/src/xrpld/app/tx/detail/LoanSet.cpp b/src/xrpld/app/tx/detail/LoanSet.cpp index b633281da9..2b5d759e67 100644 --- a/src/xrpld/app/tx/detail/LoanSet.cpp +++ b/src/xrpld/app/tx/detail/LoanSet.cpp @@ -420,7 +420,7 @@ LoanSet::doApply() auto vaultAvailableProxy = vaultSle->at(sfAssetsAvailable); auto vaultTotalProxy = vaultSle->at(sfAssetsTotal); - auto const vaultScale = vaultTotalProxy->value().exponent(); + auto const vaultScale = vaultTotalProxy.value().exponent(); if (vaultAvailableProxy < principalRequested) { JLOG(j_.warn()) @@ -513,7 +513,7 @@ LoanSet::doApply() auto const ownerCount = borrowerSle->at(sfOwnerCount); auto const balance = account_ == borrower ? mPriorBalance - : borrowerSle->at(sfBalance)->xrp(); + : borrowerSle->at(sfBalance).value().xrp(); if (balance < view.fees().accountReserve(ownerCount)) return tecINSUFFICIENT_RESERVE; } diff --git a/src/xrpld/app/tx/detail/VaultDeposit.cpp b/src/xrpld/app/tx/detail/VaultDeposit.cpp index 66e144312f..8e42fd188d 100644 --- a/src/xrpld/app/tx/detail/VaultDeposit.cpp +++ b/src/xrpld/app/tx/detail/VaultDeposit.cpp @@ -273,7 +273,8 @@ VaultDeposit::doApply() } assetsTotalProxy += assetsDeposited; assetsAvailableProxy += assetsDeposited; - if (!assetsTotalProxy->valid() || !assetsAvailableProxy->valid()) + if (!assetsTotalProxy.value().valid() || + !assetsAvailableProxy.value().valid()) return tecLIMIT_EXCEEDED; view().update(vault);