fix for the send-to-address timeout in asyncSetup
This commit is contained in:
parent
083d6a3bc3
commit
98e264f4cd
4 changed files with 10 additions and 11 deletions
|
@ -385,9 +385,7 @@ class CommandTestCase(IntegrationTestCase):
|
||||||
|
|
||||||
await self.account.ensure_address_gap()
|
await self.account.ensure_address_gap()
|
||||||
address = (await self.account.receiving.get_addresses(limit=1, only_usable=True))[0]
|
address = (await self.account.receiving.get_addresses(limit=1, only_usable=True))[0]
|
||||||
sendtxid = await self.blockchain.send_to_address(address, 10)
|
await self.send_to_address_and_wait(address, 10, 6)
|
||||||
await self.confirm_tx(sendtxid)
|
|
||||||
await self.generate(5)
|
|
||||||
|
|
||||||
server_tmp_dir = tempfile.mkdtemp()
|
server_tmp_dir = tempfile.mkdtemp()
|
||||||
self.addCleanup(shutil.rmtree, server_tmp_dir)
|
self.addCleanup(shutil.rmtree, server_tmp_dir)
|
||||||
|
|
|
@ -87,11 +87,14 @@ class ConductorService:
|
||||||
if not address:
|
if not address:
|
||||||
raise ValueError("No address was provided.")
|
raise ValueError("No address was provided.")
|
||||||
amount = data.get('amount', 1)
|
amount = data.get('amount', 1)
|
||||||
txid = await self.stack.lbcwallet_node.send_to_address(address, amount)
|
|
||||||
if self.stack.wallet_started:
|
if self.stack.wallet_started:
|
||||||
await self.stack.wallet_node.ledger.on_transaction.where(
|
watcher = self.stack.wallet_node.ledger.on_transaction.where(
|
||||||
lambda e: e.tx.id == txid and e.address == address
|
lambda e: e.address == address # and e.tx.id == txid -- might stall; see send_to_address_and_wait
|
||||||
)
|
)
|
||||||
|
txid = await self.stack.lbcwallet_node.send_to_address(address, amount)
|
||||||
|
await watcher
|
||||||
|
else:
|
||||||
|
txid = await self.stack.lbcwallet_node.send_to_address(address, amount)
|
||||||
return json_response({
|
return json_response({
|
||||||
'address': address,
|
'address': address,
|
||||||
'amount': amount,
|
'amount': amount,
|
||||||
|
|
|
@ -174,8 +174,7 @@ class PurchaseCommandTests(CommandTestCase):
|
||||||
self.merchant_address = await self.account.receiving.get_or_create_usable_address()
|
self.merchant_address = await self.account.receiving.get_or_create_usable_address()
|
||||||
daemon2 = await self.add_daemon()
|
daemon2 = await self.add_daemon()
|
||||||
address2 = await daemon2.wallet_manager.default_account.receiving.get_or_create_usable_address()
|
address2 = await daemon2.wallet_manager.default_account.receiving.get_or_create_usable_address()
|
||||||
sendtxid = await self.blockchain.send_to_address(address2, 2)
|
await self.send_to_address_and_wait(address2, 2, 1, ledger=daemon2.ledger)
|
||||||
await self.confirm_tx(sendtxid, daemon2.ledger)
|
|
||||||
|
|
||||||
stream = await self.priced_stream('a', '1.0')
|
stream = await self.priced_stream('a', '1.0')
|
||||||
await self.assertBalance(self.account, '9.987893')
|
await self.assertBalance(self.account, '9.987893')
|
||||||
|
|
|
@ -40,10 +40,9 @@ class TransactionCommandsTestCase(CommandTestCase):
|
||||||
self.assertFalse(result['success'])
|
self.assertFalse(result['success'])
|
||||||
|
|
||||||
async def test_utxo_release(self):
|
async def test_utxo_release(self):
|
||||||
sendtxid = await self.blockchain.send_to_address(
|
await self.send_to_address_and_wait(
|
||||||
await self.account.receiving.get_or_create_usable_address(), 1
|
await self.account.receiving.get_or_create_usable_address(), 1, 1
|
||||||
)
|
)
|
||||||
await self.confirm_tx(sendtxid)
|
|
||||||
await self.assertBalance(self.account, '11.0')
|
await self.assertBalance(self.account, '11.0')
|
||||||
await self.ledger.reserve_outputs(await self.account.get_utxos())
|
await self.ledger.reserve_outputs(await self.account.get_utxos())
|
||||||
await self.assertBalance(self.account, '0.0')
|
await self.assertBalance(self.account, '0.0')
|
||||||
|
|
Loading…
Add table
Reference in a new issue