fixes lint
This commit is contained in:
parent
dedf422a76
commit
ebde6e8467
|
@ -1,7 +1,6 @@
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
# RLWallet is subclass of Wallet
|
# RLWallet is subclass of Wallet
|
||||||
from binascii import hexlify
|
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
import time
|
import time
|
||||||
from secrets import token_bytes
|
from secrets import token_bytes
|
||||||
|
@ -9,7 +8,6 @@ from typing import Optional, List, Tuple, Any
|
||||||
|
|
||||||
import json
|
import json
|
||||||
from blspy import PrivateKey, AugSchemeMPL, G1Element
|
from blspy import PrivateKey, AugSchemeMPL, G1Element
|
||||||
from src.util.clvm import run_program
|
|
||||||
from clvm_tools import binutils
|
from clvm_tools import binutils
|
||||||
from src.types.coin import Coin
|
from src.types.coin import Coin
|
||||||
from src.types.coin_solution import CoinSolution
|
from src.types.coin_solution import CoinSolution
|
||||||
|
@ -342,10 +340,7 @@ class RLWallet(AbstractWallet):
|
||||||
height = lca.height
|
height = lca.height
|
||||||
assert self.rl_info.limit is not None
|
assert self.rl_info.limit is not None
|
||||||
unlocked = int(
|
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)
|
* int(self.rl_info.limit)
|
||||||
)
|
)
|
||||||
total_amount = self.rl_coin_record.coin.amount
|
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
|
# 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(
|
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 (
|
if (
|
||||||
rl_info.limit is None
|
rl_info.limit is None
|
||||||
or rl_info.interval is None
|
or rl_info.interval is None
|
||||||
or rl_info.user_pubkey is None
|
or rl_info.user_pubkey is None
|
||||||
or rl_info.admin_pubkey is None
|
or rl_info.admin_pubkey is None
|
||||||
):
|
):
|
||||||
raise ValueError("One or more of the elements of rl_info is None")
|
raise ValueError("One or more of the elements of rl_info is None")
|
||||||
if self.rl_coin_record 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]))
|
rl_spend = CoinSolution(self.rl_coin_record.coin, Program.to([puzzle, solution]))
|
||||||
|
|
||||||
list_of_coinsolutions.append(
|
list_of_coinsolutions.append(
|
||||||
rl_spend
|
rl_spend
|
||||||
)
|
)
|
||||||
|
|
||||||
# Spend consolidating coin
|
# Spend consolidating coin
|
||||||
|
@ -735,9 +730,9 @@ class RLWallet(AbstractWallet):
|
||||||
solution = Program(binutils.assemble("()"))
|
solution = Program(binutils.assemble("()"))
|
||||||
|
|
||||||
ephemeral = CoinSolution(
|
ephemeral = CoinSolution(
|
||||||
Coin(self.rl_coin_record.coin.name(), puzzle.get_tree_hash(), uint64(0)),
|
Coin(self.rl_coin_record.coin.name(), puzzle.get_tree_hash(), uint64(0)),
|
||||||
Program.to([puzzle, solution]),
|
Program.to([puzzle, solution]),
|
||||||
)
|
)
|
||||||
list_of_coinsolutions.append(ephemeral)
|
list_of_coinsolutions.append(ephemeral)
|
||||||
|
|
||||||
aggsig = AugSchemeMPL.aggregate([signature])
|
aggsig = AugSchemeMPL.aggregate([signature])
|
||||||
|
|
|
@ -49,7 +49,6 @@ class TestRLWallet:
|
||||||
await full_node.farm_new_block(FarmNewBlockProtocol(ph))
|
await full_node.farm_new_block(FarmNewBlockProtocol(ph))
|
||||||
for i in range(0, num_blocks + 1):
|
for i in range(0, num_blocks + 1):
|
||||||
await full_node.farm_new_block(FarmNewBlockProtocol(32 * b"\0"))
|
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)
|
api_user = WalletRpcApi(wallet_node_1)
|
||||||
val = await api_user.create_new_wallet(
|
val = await api_user.create_new_wallet(
|
||||||
|
@ -143,15 +142,13 @@ class TestRLWallet:
|
||||||
await full_node.farm_new_block(FarmNewBlockProtocol(32 * b"\0"))
|
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, check_balance, 97, api_user, user_wallet_id)
|
||||||
await time_out_assert(15, receiving_wallet.get_spendable_balance, 3)
|
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})
|
val = await api_admin.add_rate_limited_funds({"wallet_id": admin_wallet_id, "amount": 100})
|
||||||
assert val["status"] == "SUCCESS"
|
assert val["status"] == "SUCCESS"
|
||||||
for i in range(0, 50):
|
for i in range(0, 50):
|
||||||
await full_node.farm_new_block(FarmNewBlockProtocol(32 * b"\0"))
|
await full_node.farm_new_block(FarmNewBlockProtocol(32 * b"\0"))
|
||||||
await time_out_assert(15, check_balance, 197, api_user, user_wallet_id)
|
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(
|
val = await api_user.send_transaction(
|
||||||
{
|
{
|
||||||
"wallet_id": user_wallet_id,
|
"wallet_id": user_wallet_id,
|
||||||
|
|
Loading…
Reference in New Issue