From 2cb9d5c63612399b0990ac7c30969cc1a6065843 Mon Sep 17 00:00:00 2001 From: Lex Berezhny Date: Wed, 16 Jan 2019 13:28:12 -0500 Subject: [PATCH] orchstr service transfer command works without wallet availability --- torba/orchstr8/service.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/torba/orchstr8/service.py b/torba/orchstr8/service.py index da72a5c62..3c368c457 100644 --- a/torba/orchstr8/service.py +++ b/torba/orchstr8/service.py @@ -80,13 +80,16 @@ class ConductorService: async def transfer(self, request): data = await request.post() address = data.get('address') - if not address: + if not address and self.stack.wallet_started: address = await self.stack.wallet_node.account.receiving.get_or_create_usable_address() + if not address: + raise ValueError("No address was provided.") amount = data.get('amount', 1) txid = await self.stack.blockchain_node.send_to_address(address, amount) - await self.stack.wallet_node.ledger.on_transaction.where( - lambda e: e.tx.id == txid and e.address == address - ) + if self.stack.wallet_started: + await self.stack.wallet_node.ledger.on_transaction.where( + lambda e: e.tx.id == txid and e.address == address + ) return json_response({ 'address': address, 'amount': amount,