2
0
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:
23rd
2024-10-26 19:09:37 +03:00
parent 08fda055fc
commit b23a877d7e
2 changed files with 13 additions and 0 deletions

View File

@@ -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