mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-03 09:56:38 -05:00
policy/fees: remove a floating-point division by zero
Reported-by: practicalswift <practicalswift@users.noreply.github.com> Signed-off-by: Antoine Poinsot <darosior@protonmail.com>
This commit is contained in:
parent
c36869bbf6
commit
a3abeec33a
2 changed files with 11 additions and 3 deletions
|
@ -325,13 +325,22 @@ double TxConfirmStats::EstimateMedianVal(int confTarget, double sufficientTxVal,
|
|||
failBucket.leftMempool = failNum;
|
||||
}
|
||||
|
||||
float passed_within_target_perc = 0.0;
|
||||
float failed_within_target_perc = 0.0;
|
||||
if ((passBucket.totalConfirmed + passBucket.inMempool + passBucket.leftMempool)) {
|
||||
passed_within_target_perc = 100 * passBucket.withinTarget / (passBucket.totalConfirmed + passBucket.inMempool + passBucket.leftMempool);
|
||||
}
|
||||
if ((failBucket.totalConfirmed + failBucket.inMempool + failBucket.leftMempool)) {
|
||||
failed_within_target_perc = 100 * failBucket.withinTarget / (failBucket.totalConfirmed + failBucket.inMempool + failBucket.leftMempool);
|
||||
}
|
||||
|
||||
LogPrint(BCLog::ESTIMATEFEE, "FeeEst: %d > %.0f%% decay %.5f: feerate: %g from (%g - %g) %.2f%% %.1f/(%.1f %d mem %.1f out) Fail: (%g - %g) %.2f%% %.1f/(%.1f %d mem %.1f out)\n",
|
||||
confTarget, 100.0 * successBreakPoint, decay,
|
||||
median, passBucket.start, passBucket.end,
|
||||
100 * passBucket.withinTarget / (passBucket.totalConfirmed + passBucket.inMempool + passBucket.leftMempool),
|
||||
passed_within_target_perc,
|
||||
passBucket.withinTarget, passBucket.totalConfirmed, passBucket.inMempool, passBucket.leftMempool,
|
||||
failBucket.start, failBucket.end,
|
||||
100 * failBucket.withinTarget / (failBucket.totalConfirmed + failBucket.inMempool + failBucket.leftMempool),
|
||||
failed_within_target_perc,
|
||||
failBucket.withinTarget, failBucket.totalConfirmed, failBucket.inMempool, failBucket.leftMempool);
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
# -fsanitize=undefined suppressions
|
||||
# =================================
|
||||
float-divide-by-zero:policy/fees.cpp
|
||||
float-divide-by-zero:validation.cpp
|
||||
float-divide-by-zero:wallet/wallet.cpp
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue