From ebde6e84678db86b4e957f3bad929921e98ca052 Mon Sep 17 00:00:00 2001 From: Will Bendick Date: Mon, 21 Sep 2020 14:48:30 -0700 Subject: [PATCH] fixes lint --- src/rpc/wallet_rpc_api.py | 2 +- src/wallet/rl_wallet/rl_wallet.py | 25 ++++++++++--------------- tests/rl_wallet/test_rl_rpc.py | 5 +---- 3 files changed, 12 insertions(+), 20 deletions(-) diff --git a/src/rpc/wallet_rpc_api.py b/src/rpc/wallet_rpc_api.py index 12057a45..73efe859 100644 --- a/src/rpc/wallet_rpc_api.py +++ b/src/rpc/wallet_rpc_api.py @@ -713,4 +713,4 @@ class WalletRpcApi: request['wallet_id'] = 1 request['puzzle_hash'] = puzzle_hash await wallet.rl_add_funds(request['amount'], puzzle_hash) - return {"status": "SUCCESS"} \ No newline at end of file + return {"status": "SUCCESS"} diff --git a/src/wallet/rl_wallet/rl_wallet.py b/src/wallet/rl_wallet/rl_wallet.py index 6bc79d1b..552b44f1 100644 --- a/src/wallet/rl_wallet/rl_wallet.py +++ b/src/wallet/rl_wallet/rl_wallet.py @@ -1,7 +1,6 @@ import logging # RLWallet is subclass of Wallet -from binascii import hexlify from dataclasses import dataclass import time from secrets import token_bytes @@ -9,7 +8,6 @@ from typing import Optional, List, Tuple, Any import json from blspy import PrivateKey, AugSchemeMPL, G1Element -from src.util.clvm import run_program from clvm_tools import binutils from src.types.coin import Coin from src.types.coin_solution import CoinSolution @@ -342,10 +340,7 @@ class RLWallet(AbstractWallet): height = lca.height assert self.rl_info.limit is not None unlocked = int( - ( - (height - self.rl_coin_record.confirmed_block_index) - / self.rl_info.interval - ) + ((height - self.rl_coin_record.confirmed_block_index) / self.rl_info.interval) * int(self.rl_info.limit) ) total_amount = self.rl_coin_record.coin.amount @@ -675,13 +670,13 @@ class RLWallet(AbstractWallet): # This is for using the AC locked coin and aggregating it into wallet - must happen in same block as RL Mode 2 async def rl_generate_signed_aggregation_transaction( - self, rl_info: RLInfo, consolidating_coin: Coin, rl_parent: Coin, rl_coin: Coin + self, rl_info: RLInfo, consolidating_coin: Coin, rl_parent: Coin, rl_coin: Coin ): if ( - rl_info.limit is None - or rl_info.interval is None - or rl_info.user_pubkey is None - or rl_info.admin_pubkey is None + rl_info.limit is None + or rl_info.interval is None + or rl_info.user_pubkey is None + or rl_info.admin_pubkey is None ): raise ValueError("One or more of the elements of rl_info is None") if self.rl_coin_record is None: @@ -713,7 +708,7 @@ class RLWallet(AbstractWallet): rl_spend = CoinSolution(self.rl_coin_record.coin, Program.to([puzzle, solution])) list_of_coinsolutions.append( - rl_spend + rl_spend ) # Spend consolidating coin @@ -735,9 +730,9 @@ class RLWallet(AbstractWallet): solution = Program(binutils.assemble("()")) ephemeral = CoinSolution( - Coin(self.rl_coin_record.coin.name(), puzzle.get_tree_hash(), uint64(0)), - Program.to([puzzle, solution]), - ) + Coin(self.rl_coin_record.coin.name(), puzzle.get_tree_hash(), uint64(0)), + Program.to([puzzle, solution]), + ) list_of_coinsolutions.append(ephemeral) aggsig = AugSchemeMPL.aggregate([signature]) diff --git a/tests/rl_wallet/test_rl_rpc.py b/tests/rl_wallet/test_rl_rpc.py index 64ca1732..ea6df4e6 100644 --- a/tests/rl_wallet/test_rl_rpc.py +++ b/tests/rl_wallet/test_rl_rpc.py @@ -49,7 +49,6 @@ class TestRLWallet: await full_node.farm_new_block(FarmNewBlockProtocol(ph)) for i in range(0, num_blocks + 1): await full_node.farm_new_block(FarmNewBlockProtocol(32 * b"\0")) - fund_owners_initial_balance = await wallet.get_confirmed_balance() api_user = WalletRpcApi(wallet_node_1) val = await api_user.create_new_wallet( @@ -143,15 +142,13 @@ class TestRLWallet: await full_node.farm_new_block(FarmNewBlockProtocol(32 * b"\0")) await time_out_assert(15, check_balance, 97, api_user, user_wallet_id) await time_out_assert(15, receiving_wallet.get_spendable_balance, 3) - utxo = [c for c in await full_node.coin_store.get_unspent_coin_records() if not c.coinbase] val = await api_admin.add_rate_limited_funds({"wallet_id": admin_wallet_id, "amount": 100}) assert val["status"] == "SUCCESS" for i in range(0, 50): await full_node.farm_new_block(FarmNewBlockProtocol(32 * b"\0")) await time_out_assert(15, check_balance, 197, api_user, user_wallet_id) - utxo_2 = [c for c in await full_node.coin_store.get_unspent_coin_records() if not c.coinbase] - #test spending + # test spending val = await api_user.send_transaction( { "wallet_id": user_wallet_id,