Skip to content
This repository was archived by the owner on Apr 8, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion test/functional/feature_staking_unlock_and_withdraw.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ def run_test(self):
assert_equal(len(ledger[0][1]['unlocking']),0)

alice_stash = Keypair.create_from_uri('//Alice//stash')
alice = Keypair.create_from_uri('//Alice')

# fetch the genesis utxo from storage
utxos = list(client.utxos_for(alice_stash))
Expand All @@ -87,9 +88,17 @@ def run_test(self):
assert_equal(events[2].value['event_id'], 'StakeUnlocked')

ledger = list(client.get_staking_ledger())

assert_equal(len(ledger),2)

time.sleep(500)
time_elapsed = 0
max_wait = 1200
time_step = 1
while client.current_era() < client.withdrawal_era(alice):
if time_elapsed > max_wait:
raise Exception('Timeout: waited too long for withdrawal_era')
time.sleep(time_step)
time_elapsed +=time_step

(_, _, w_events) = client.withdraw_stake(alice_stash)

Expand Down
5 changes: 4 additions & 1 deletion test/functional/test_framework/mintlayer/staking.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ def current_era(self):
module='Staking',
storage_function='CurrentEra'
)
return query
# this query returns an object of type scalecodec.types.U32
# so we convert it to an integer
# TODO find a more elegant way to do conversion
return int("{}".format(query))

""" gets the staking ledger of the given key """
def get_ledger(self, keypair):
Expand Down
2 changes: 1 addition & 1 deletion test/functional/test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
'feature_staking_withdraw_no_unlock.py',
'feature_staking_withdraw_not_validator.py',
'feature_smart_contract_test.py',
# 'feature_staking_unlock_and_withdraw.py' ## should be ran on 20 secs
'feature_staking_unlock_and_withdraw.py' ## should be ran on 20 secs
# Don't append tests at the end to avoid merge conflicts
# Put them in a random line within the section that fits their approximate run-time
]
Expand Down