Skip to content

Commit a144901

Browse files
Merge pull request #1168 from mintlayer/feature/refactor-wallet-sync
Feature/refactor wallet sync
2 parents be0de14 + 80f79a5 commit a144901

File tree

6 files changed

+336
-167
lines changed

6 files changed

+336
-167
lines changed

test/functional/test_framework/wallet_cli_controller.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,19 @@ async def _read_available_output(self) -> str:
6969
try:
7070
output = await asyncio.wait_for(self.process.stdout.read(ONE_MB), timeout=READ_TIMEOUT_SEC)
7171
self.wallet_commands_file.write(output)
72-
return output.decode().strip()
72+
result = output.decode().strip()
73+
74+
try:
75+
while True:
76+
output = await asyncio.wait_for(self.process.stdout.read(ONE_MB), timeout=0.1)
77+
if not output:
78+
break
79+
self.wallet_commands_file.write(output)
80+
result += output.decode().strip()
81+
except:
82+
pass
83+
84+
return result
7385
except:
7486
self.wallet_commands_file.write(b"read from stdout timedout\n")
7587
return ''

test/functional/test_runner.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,12 @@ class UnicodeOnWindowsError(ValueError):
125125
'p2p_relay_transactions.py',
126126
'feature_db_reinit.py',
127127
'feature_lmdb_backend_test.py',
128-
# 'wallet_submit_tx.py',
129-
# 'wallet_select_utxos.py',
130-
# 'wallet_recover_accounts.py',
131-
# 'wallet_get_address_usage.py',
132-
# 'wallet_tokens.py',
133-
# 'wallet_nfts.py',
128+
'wallet_submit_tx.py',
129+
'wallet_select_utxos.py',
130+
'wallet_recover_accounts.py',
131+
'wallet_get_address_usage.py',
132+
'wallet_tokens.py',
133+
'wallet_nfts.py',
134134
'mempool_basic_reorg.py',
135135
'mempool_eviction.py',
136136
'mempool_ibd.py',

test/functional/wallet_get_address_usage.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,9 @@ async def async_test(self):
129129
+-------+----------------------------------------------+--------------------------------+
130130
| 6 | rmt1q8lrw5tzgmwjnsc26v8qfu8k2jmddpmhwqz6kwt7 | No |
131131
+-------+----------------------------------------------+--------------------------------+"""
132-
assert expected_output == await wallet.get_addresses_usage()
132+
output = await wallet.get_addresses_usage()
133+
for (line, expected_line) in zip(output.split(), expected_output.split()):
134+
assert line == expected_line
133135

134136

135137
if __name__ == '__main__':

test/functional/wallet_recover_accounts.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,6 @@ async def async_test(self):
135135
assert mnemonic is not None
136136
assert "Successfully closed the wallet" in await wallet.close_wallet()
137137
assert "New wallet created successfully" in await wallet.recover_wallet(mnemonic)
138-
# check that balance is 0 and accounts are not present
139-
assert "Coins amount: 0" in await wallet.get_balance()
140-
for idx in range(num_accounts):
141-
assert f"Account not found for index: {idx+1}" in await wallet.select_account(idx+1)
142138

143139
# sync and check that accounts are now present and with correct balances
144140
assert "Success" in await wallet.sync()

0 commit comments

Comments
 (0)