From 159504f70357de780d219e1cfed0f111e82cdd97 Mon Sep 17 00:00:00 2001 From: lza_menace Date: Thu, 2 Feb 2023 23:32:15 -0800 Subject: [PATCH] change how tips are processed - per user --- suchwow/cli.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/suchwow/cli.py b/suchwow/cli.py index 37254e7..5468564 100644 --- a/suchwow/cli.py +++ b/suchwow/cli.py @@ -55,18 +55,19 @@ def generate_data(): @bp.cli.command('process_tips') def process_tips(): w = wownero.Wallet() - for post in Post.select().order_by(Post.timestamp.desc()): - print(f'Checking new tips for post {post.id}') - txes = w.transfers(config.WALLET_ACCOUNT, [post.address_index]) - addr = w.get_address(config.WALLET_ACCOUNT, [post.address_index]) - if post.address != addr['addresses'][0]['address']: - print(f'addresses dont match. skipping.') + for user in User.select().order_by(User.id.desc()): + user_posts = Post.select().where(Post.user == user) + if user_posts.count() == 0: continue + addresses = [i.address_index for i in user_posts] + txes = w.transfers(config.WALLET_ACCOUNT, addresses) if txes: for tx in txes['in']: if tx['unlock_time'] > 0: print('someone added a lock time to this tx. skipping for now.') continue + if tx['confirmations'] < 5: + continue _tx = TipReceived.select().where(TipReceived.txid == tx['txid']).first() if not _tx: post = Post.select().where(Post.address == tx['address']).first()