Skip to content

Commit

Permalink
fix: intermittent failures in feature_asset_locks.py (dashpay#5875)
Browse files Browse the repository at this point in the history
## Issue being fixed or feature implemented
fix failures like https://gitlab.com/dashpay/dash/-/jobs/6175160403

## What was done?
use `minimumAmount` option in `listunspent` rpc call to avoid picking
coins that are too small for asset lock txes

## How Has This Been Tested?
run `feature_asset_locks.py`

## Breaking Changes
n/a

## Checklist:
- [x] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have added or updated relevant unit/integration/functional/e2e
tests
- [ ] I have made corresponding changes to the documentation
- [x] I have assigned this pull request to a milestone
  • Loading branch information
UdjinM6 authored Feb 15, 2024
1 parent 015e30f commit fa4ced9
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions test/functional/feature_asset_locks.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,10 +273,8 @@ def test_asset_locks(self, node_wallet, node, pubkey):
locked_1 = 10 * COIN + 141421
locked_2 = 10 * COIN + 314159

coins = node_wallet.listunspent()
coin = None
while coin is None or COIN * coin['amount'] < locked_2:
coin = coins.pop()
coins = node_wallet.listunspent(query_options={'minimumAmount': Decimal(str(locked_2 / COIN))})
coin = coins.pop()
asset_lock_tx = self.create_assetlock(coin, locked_1, pubkey)


Expand Down Expand Up @@ -604,7 +602,7 @@ def test_mn_rr(self, node_wallet, node, pubkey):
locked += platform_reward
assert_equal(locked, self.get_credit_pool_balance())

coins = node_wallet.listunspent()
coins = node_wallet.listunspent(query_options={'minimumAmount': 1})
coin = coins.pop()
self.send_tx(self.create_assetlock(coin, COIN, pubkey))
locked += platform_reward + COIN
Expand Down

0 comments on commit fa4ced9

Please sign in to comment.