Conversation
There was a problem hiding this comment.
Bug: Undefined Methods Cause Balance Calculation Errors
The total_balance_sat method in WalletState and the sats_value_of_proofs function in Wallet attempt to call undefined melt_exchange_rate and mint_exchange_rate methods, respectively, on Mint objects when processing non-BTC proofs. This causes an AttributeError and prevents accurate balance calculation. Additionally, Mint instances are created in a loop without proper cleanup, leading to resource leaks.
sixty_nuts/types.py#L142-L159
sixty-nuts/sixty_nuts/types.py
Lines 142 to 159 in 3108320
sixty_nuts/wallet.py#L2735-L2737
sixty-nuts/sixty_nuts/wallet.py
Lines 2735 to 2737 in 3108320
Bug: Bitcoin Exchange Rate Method Inverts Values
The melt_exchange_rate method returns inverted exchange rates for Bitcoin units. For "sat", it incorrectly returns 1000 instead of 1. For "msat", it incorrectly returns 1 instead of 0.001. This results in incorrect currency conversions.
sixty_nuts/mint.py#L391-L398
Lines 391 to 398 in 3108320
Bug: Mint Quote Creation Fails Without Currencies
An IndexError occurs in Mint.create_mint_quote and Mint.create_melt_quote methods when the unit parameter is None. This happens because the code attempts to access currencies[0] from the list of available currencies without checking if the list is empty, leading to an error if the mint provides no currencies.
sixty_nuts/mint.py#L433-L434
Lines 433 to 434 in 3108320
sixty_nuts/mint.py#L490-L491
Lines 490 to 491 in 3108320
Was this report helpful? Give feedback by reacting with 👍 or 👎
No description provided.