@@ -24,12 +24,12 @@ def __init__(self):
2424 def add (self , item ):
2525 # Check if item already exists (using __eq__)
2626 if item not in self ._items :
27- # Insert item in sorted position (using __lt__ )
27+ # Insert item in sorted position for descending order (using __gt__ )
2828 for i , existing_item in enumerate (self ._items ):
29- if item < existing_item :
29+ if item > existing_item :
3030 self ._items .insert (i , item )
3131 return
32- # If item is larger than all existing items, append it
32+ # If item is smaller than all existing items, append it
3333 self ._items .append (item )
3434
3535 def __iter__ (self ):
@@ -56,9 +56,8 @@ def __eq__(self, other):
5656 return False
5757 return all (p1 == p2 for p1 , p2 in zip (self ._items , other ))
5858
59-
59+ # Payment class remains unchanged
6060class Payment :
61-
6261 def __init__ (self , epoch_time , amount_sats , comment ):
6362 self .epoch_time = epoch_time
6463 self .amount_sats = amount_sats
@@ -96,8 +95,6 @@ def __ge__(self, other):
9695 return (self .epoch_time , self .amount_sats , self .comment ) >= (other .epoch_time , other .amount_sats , other .comment )
9796
9897
99-
100-
10198class Wallet :
10299
103100 # These values could be loading from a cache.json file at __init__
@@ -374,7 +371,7 @@ def wallet_manager_thread(self):
374371 elif type != "incoming" :
375372 print (f"WARNING: invalid notification type { type } , ignoring." )
376373 continue
377- new_balance = self .balance + amount
374+ new_balance = self .last_known_balance + amount
378375 self .handle_new_balance (new_balance , False )
379376 epoch_time = transaction ["created_at" ]
380377 comment = self .getCommentFromTransaction (notification )
0 commit comments