mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 14:38:15 +00:00
Added ability to cache currency balance by peer.
This commit is contained in:
@@ -74,6 +74,11 @@ uint64 Credits::balance(PeerId peerId) const {
|
||||
return (it != _cachedPeerBalances.end()) ? it->second : 0;
|
||||
}
|
||||
|
||||
uint64 Credits::balanceCurrency(PeerId peerId) const {
|
||||
const auto it = _cachedPeerCurrencyBalances.find(peerId);
|
||||
return (it != _cachedPeerCurrencyBalances.end()) ? it->second : 0;
|
||||
}
|
||||
|
||||
rpl::producer<uint64> Credits::balanceValue() const {
|
||||
return _nonLockedBalance.value();
|
||||
}
|
||||
@@ -128,4 +133,8 @@ void Credits::apply(PeerId peerId, uint64 balance) {
|
||||
_cachedPeerBalances[peerId] = balance;
|
||||
}
|
||||
|
||||
void Credits::applyCurrency(PeerId peerId, uint64 balance) {
|
||||
_cachedPeerCurrencyBalances[peerId] = balance;
|
||||
}
|
||||
|
||||
} // namespace Data
|
||||
|
Reference in New Issue
Block a user