mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
mulDiv returns 0 if numerator is 0 and denominator isn't:
* Otherwise overflow checks result in divide by 0. * If denominator is 0, let the divide by 0 exception throw. * Move mulDiv out of STAmount
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
|
||||
#include <BeastConfig.h>
|
||||
#include <ripple/basics/contract.h>
|
||||
#include <ripple/basics/mulDiv.h>
|
||||
#include <ripple/core/LoadFeeTrack.h>
|
||||
#include <ripple/core/Config.h>
|
||||
#include <ripple/protocol/STAmount.h>
|
||||
@@ -31,7 +32,7 @@ std::uint64_t
|
||||
LoadFeeTrack::scaleFeeBase (std::uint64_t fee, std::uint64_t baseFee,
|
||||
std::uint32_t referenceFeeUnits) const
|
||||
{
|
||||
return mulDiv (fee, baseFee, referenceFeeUnits);
|
||||
return mulDivThrow (fee, baseFee, referenceFeeUnits);
|
||||
}
|
||||
|
||||
// Scale using load as well as base rate
|
||||
@@ -116,7 +117,7 @@ LoadFeeTrack::getJson (std::uint64_t baseFee,
|
||||
// load_fee = The cost to send a "reference" transaction now,
|
||||
// in millionths of a Ripple
|
||||
j[jss::load_fee] = Json::Value::UInt (
|
||||
mulDiv (baseFee, std::max (mLocalTxnLoadFee,
|
||||
mulDivThrow(baseFee, std::max(mLocalTxnLoadFee,
|
||||
mRemoteTxnLoadFee), lftNormalFee));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user