Enhance transaction time handling: Updated the transaction processing logic to ensure all timestamps are normalized to UTC for consistency. Added logging to warn about timezone-naive timestamps and to inform about conversions from other timezones. Adjusted the client balance summary logging to include timezone information when as_of_time is used, improving clarity in balance reporting.

This commit is contained in:
padreug 2025-07-05 15:48:51 +02:00
parent 7e39bb160a
commit c5227100b8
2 changed files with 27 additions and 4 deletions

View file

@ -260,7 +260,9 @@ async def get_client_balance_summary(client_id: str, as_of_time: Optional[dateti
# Log temporal filtering if as_of_time was used
if as_of_time is not None:
from lnbits.core.services import logger
logger.info(f"Client {client_id[:8]}... balance as of {as_of_time}: {total_deposits - total_payments} centavos remaining")
# Verify timezone consistency for temporal filtering
tz_info = "UTC" if as_of_time.tzinfo == timezone.utc else f"TZ: {as_of_time.tzinfo}"
logger.info(f"Client {client_id[:8]}... balance as of {as_of_time} ({tz_info}): {total_deposits - total_payments} centavos remaining")
return ClientBalanceSummary(
client_id=client_id,