Use z = std::max(x - y, 0); instead of z = x - y; if (z < 0) z = 0;
This commit is contained in:
parent
b709fe7ffc
commit
a47da4b6fe
2 changed files with 2 additions and 8 deletions
|
@ -53,11 +53,7 @@ bool CAddrInfo::IsTerrible(int64_t nNow) const
|
||||||
double CAddrInfo::GetChance(int64_t nNow) const
|
double CAddrInfo::GetChance(int64_t nNow) const
|
||||||
{
|
{
|
||||||
double fChance = 1.0;
|
double fChance = 1.0;
|
||||||
|
int64_t nSinceLastTry = std::max<int64_t>(nNow - nLastTry, 0);
|
||||||
int64_t nSinceLastTry = nNow - nLastTry;
|
|
||||||
|
|
||||||
if (nSinceLastTry < 0)
|
|
||||||
nSinceLastTry = 0;
|
|
||||||
|
|
||||||
// deprioritize very recent attempts away
|
// deprioritize very recent attempts away
|
||||||
if (nSinceLastTry < 60 * 10)
|
if (nSinceLastTry < 60 * 10)
|
||||||
|
|
|
@ -563,9 +563,7 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
|
||||||
}
|
}
|
||||||
|
|
||||||
// after fee
|
// after fee
|
||||||
nAfterFee = nAmount - nPayFee;
|
nAfterFee = std::max<CAmount>(nAmount - nPayFee, 0);
|
||||||
if (nAfterFee < 0)
|
|
||||||
nAfterFee = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// actually update labels
|
// actually update labels
|
||||||
|
|
Loading…
Reference in a new issue