Skip to content

Commit 59abcee

Browse files
authored
chore(Ledger): Update some comments (#3847)
Update some comments regarding maximum values for tokens.
1 parent 7670fdb commit 59abcee

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

rs/ledger_suite/common/ledger_core/src/balances.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ where
108108
fee_collector: Option<&S::AccountId>,
109109
) -> Result<(), BalanceError<S::Tokens>> {
110110
let debit_amount = amount.checked_add(&fee).ok_or_else(|| {
111-
// No account can hold more than u64::MAX.
111+
// No account can hold more than Tokens::max_value().
112112
let balance = self.account_balance(from);
113113
BalanceError::InsufficientFunds { balance }
114114
})?;
@@ -118,7 +118,7 @@ where
118118
None => {
119119
// NB. integer overflow is not possible here unless there is a
120120
// severe bug in the system: total amount of tokens in the
121-
// circulation cannot exceed u64::MAX.
121+
// circulation cannot exceed Tokens::max_value().
122122
self.token_pool = self
123123
.token_pool
124124
.checked_add(&fee)
@@ -155,8 +155,8 @@ where
155155
Ok(())
156156
}
157157

158-
// Debiting an account will automatically remove it from the `inner`
159-
// HashMap if the balance reaches zero.
158+
// Debiting an account will automatically remove it from the inner
159+
// `BalancesStore` if the balance reaches zero.
160160
pub fn debit(
161161
&mut self,
162162
from: &S::AccountId,
@@ -191,8 +191,8 @@ where
191191
|prev| -> Result<S::Tokens, std::convert::Infallible> {
192192
// NB. credit cannot overflow unless there is a bug in the
193193
// system: the total amount of tokens in the circulation cannot
194-
// exceed u64::MAX, so it's impossible to have more than
195-
// u64::MAX tokens on a single account.
194+
// exceed Tokens::max_value(), so it's impossible to have more than
195+
// Tokens::max_value() tokens on a single account.
196196
Ok(amount
197197
.checked_add(prev.unwrap_or(&S::Tokens::zero()))
198198
.expect("bug: overflow in credit"))

0 commit comments

Comments
 (0)