From 994271653c0d8163a3fae3d44c8424dc827d5f25 Mon Sep 17 00:00:00 2001 From: lza_menace Date: Tue, 6 Oct 2020 01:41:05 -0700 Subject: [PATCH] making adjustments so that local app works with prod db --- suchwow/routes/post.py | 2 +- suchwow/wownero.py | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/suchwow/routes/post.py b/suchwow/routes/post.py index 787496d..7a387f9 100644 --- a/suchwow/routes/post.py +++ b/suchwow/routes/post.py @@ -33,7 +33,7 @@ def read(id): post = Post.get(id=id) comments = Comment.select().where(Comment.post==post.id) if wallet.connected: - address = wallet.addresses(account=post.account_index)[0] + address = wallet.get_address(account=post.account_index) transfers = wallet.transfers(account=post.account_index) else: address = "?" diff --git a/suchwow/wownero.py b/suchwow/wownero.py index 23bf657..bfe73cc 100644 --- a/suchwow/wownero.py +++ b/suchwow/wownero.py @@ -72,11 +72,21 @@ class Wallet(object): if addr_indices: qdata['address_index'] = addr_indices _addresses = self.make_wallet_rpc('get_address', qdata) + if 'message' in _addresses: + return None addresses = [None] * (max(map(operator.itemgetter('address_index'), _addresses['addresses'])) + 1) for _addr in _addresses['addresses']: addresses[_addr['address_index']] = _addr['address'] return addresses + def get_address(self, account): + qdata = {'account_index': account} + _addresses = self.make_wallet_rpc('get_address', qdata) + if 'address' in _addresses: + return _addresses['address'] + else: + return None + def new_address(self, account, label=None): data = {'account_index': account, 'label': label} _address = self.make_wallet_rpc('create_address', data)