ts_xmr_autosign: improve balance checking

This commit is contained in:
The MMGen Project 2023-05-07 17:11:53 +00:00
commit 403d3be586
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
3 changed files with 16 additions and 5 deletions

View file

@ -127,8 +127,7 @@ init_tests() {
d_xmr="Monero xmrwallet operations"
t_xmr="
- $test_py --coin=xmr --exclude=xmr_autosign
- $test_py --coin=xmr xmr_autosign
- $test_py --coin=xmr
"
d_eth="operations for Ethereum and Ethereum Classic using devnet"

View file

@ -63,7 +63,8 @@ class TestSuiteXMRAutosign(TestSuiteXMRWallet,TestSuiteAutosignBase):
('gen_kafiles', 'generating key-address files for Miner'),
('create_wallets_miner', 'creating Monero wallets for Miner'),
('mine_initial_coins', 'mining initial coins'),
('fund_alice', 'sending funds to Alice'),
('fund_alice1', 'sending funds to Alice (wallet #1)'),
('fund_alice2', 'sending funds to Alice (wallet #2)'),
('autosign_start_thread', 'starting autosign wait loop'),
('create_transfer_tx1', 'creating a transfer TX'),
('submit_transfer_tx1', 'submitting the transfer TX'),
@ -199,6 +200,12 @@ class TestSuiteXMRAutosign(TestSuiteXMRWallet,TestSuiteAutosignBase):
def delete_dump_files(self):
return self._delete_files( '.dump' )
def fund_alice1(self):
return self.fund_alice(wallet=1,check_bal=False)
def fund_alice2(self):
return self.fund_alice(wallet=2)
def insert_device(self):
self.asi.dev_disk_path.touch()
@ -295,7 +302,10 @@ class TestSuiteXMRAutosign(TestSuiteXMRWallet,TestSuiteAutosignBase):
return self._sync_chkbal( '1', lambda n,b,ub: b == ub and 0.8 < b < 0.86 )
# 1.234567891234 - 0.124 - 0.257 = 0.853567891234 (minus fees)
sync_chkbal3 = sync_chkbal2
def sync_chkbal3(self):
return self._sync_chkbal(
'1-2',
lambda n,b,ub: b == ub and ((n == 1 and 0.8 < b < 0.86) or (n == 2 and b > 1.23)) )
def _mine_chk(self,desc):
bal_type = {'locked':'b','unlocked':'ub'}[desc]

View file

@ -416,13 +416,15 @@ class TestSuiteXMRWallet(TestSuiteBase):
ok()
return await self.mine_chk('miner',1,0,lambda x: x.ub > 20,'unlocked balance > 20')
async def fund_alice(self,wallet=1):
async def fund_alice(self,wallet=1,check_bal=True):
self.spawn('', msg_only=True, extra_desc='(transferring funds from Miner wallet)')
await self.transfer(
'miner',
1234567891234,
read_from_file(self.users['alice'].addrfile_fs.format(wallet)),
)
if not check_bal:
return 'ok'
ok()
bal = '1.234567891234'
return await self.mine_chk(