Skip to content

Commit

Permalink
Simplify getting wallet spendable coins' count in test_dusted_wallet …
Browse files Browse the repository at this point in the history
…(and correct its type) (#17310)

Simplify getting wallet spendable coins' count in test_dusted_wallet (and correct its type).
  • Loading branch information
AmineKhaldi committed Jan 16, 2024
1 parent 78b7904 commit aaa1686
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions tests/wallet/sync/test_wallet_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -791,9 +791,8 @@ async def test_dusted_wallet(
# Selecting coins by using the wallet's coin selection algorithm won't work for large
# numbers of coins, so we'll use the state manager for the rest of the test
# num_coins: Optional[Message] = len(await dust_wallet.select_coins(balance))
num_coins: Optional[Message] = len(
list(await dust_wallet_node.wallet_state_manager.get_spendable_coins_for_wallet(1))
)
spendable_coins = await dust_wallet_node.wallet_state_manager.get_spendable_coins_for_wallet(1)
num_coins = len(spendable_coins)

log.info(f"Small coin count is {small_unspent_count}")
log.info(f"Wallet balance is {balance}")
Expand Down Expand Up @@ -833,9 +832,8 @@ async def test_dusted_wallet(
all_unspent: Set[WalletCoinRecord] = await dust_wallet_node.wallet_state_manager.coin_store.get_all_unspent_coins()
small_unspent_count = len([r for r in all_unspent if r.coin.amount < xch_spam_amount])
balance: Optional[Message] = await dust_wallet.get_confirmed_balance()
num_coins: Optional[Message] = len(
list(await dust_wallet_node.wallet_state_manager.get_spendable_coins_for_wallet(1))
)
spendable_coins = await dust_wallet_node.wallet_state_manager.get_spendable_coins_for_wallet(1)
num_coins = len(spendable_coins)

log.info(f"Small coin count is {small_unspent_count}")
log.info(f"Wallet balance is {balance}")
Expand Down Expand Up @@ -870,9 +868,8 @@ async def test_dusted_wallet(
all_unspent: Set[WalletCoinRecord] = await dust_wallet_node.wallet_state_manager.coin_store.get_all_unspent_coins()
small_unspent_count = len([r for r in all_unspent if r.coin.amount < xch_spam_amount])
balance: Optional[Message] = await dust_wallet.get_confirmed_balance()
num_coins: Optional[Message] = len(
list(await dust_wallet_node.wallet_state_manager.get_spendable_coins_for_wallet(1))
)
spendable_coins = await dust_wallet_node.wallet_state_manager.get_spendable_coins_for_wallet(1)
num_coins = len(spendable_coins)

log.info(f"Small coin count is {small_unspent_count}")
log.info(f"Wallet balance is {balance}")
Expand Down Expand Up @@ -927,9 +924,8 @@ async def test_dusted_wallet(
all_unspent: Set[WalletCoinRecord] = await dust_wallet_node.wallet_state_manager.coin_store.get_all_unspent_coins()
small_unspent_count = len([r for r in all_unspent if r.coin.amount < xch_spam_amount])
balance: Optional[Message] = await dust_wallet.get_confirmed_balance()
num_coins: Optional[Message] = len(
list(await dust_wallet_node.wallet_state_manager.get_spendable_coins_for_wallet(1))
)
spendable_coins = await dust_wallet_node.wallet_state_manager.get_spendable_coins_for_wallet(1)
num_coins = len(spendable_coins)

log.info(f"Small coin count is {small_unspent_count}")
log.info(f"Wallet balance is {balance}")
Expand Down

0 comments on commit aaa1686

Please sign in to comment.