|
1 | 1 | import asyncio
|
2 |
| -import math |
3 | 2 | import copy
|
4 | 3 | import logging
|
| 4 | +import math |
5 | 5 | import os
|
6 | 6 | import random
|
7 | 7 | import shutil
|
|
12 | 12 | from argparse import Namespace
|
13 | 13 | from dataclasses import replace
|
14 | 14 | from pathlib import Path
|
15 |
| -from typing import Callable, Dict, List, Optional, Tuple, Any, Union |
| 15 | +from typing import Any, Callable, Dict, List, Optional, Tuple, Union |
16 | 16 |
|
17 | 17 | from blspy import AugSchemeMPL, G1Element, G2Element, PrivateKey
|
| 18 | +from chia_rs import compute_merkle_set_root |
18 | 19 | from chiabip158 import PyBIP158
|
19 | 20 |
|
20 | 21 | from chia.cmds.init_funcs import create_all_ssl, create_default_chia_config
|
21 |
| -from chia.daemon.keychain_proxy import connect_to_keychain_and_validate, wrap_local_keychain, KeychainProxy |
22 |
| -from chia.full_node.bundle_tools import ( |
23 |
| - best_solution_generator_from_template, |
24 |
| - detect_potential_template_generator, |
25 |
| - simple_solution_generator, |
26 |
| -) |
27 |
| -from chia.util.errors import Err |
28 |
| -from chia.full_node.generator import setup_generator_args |
29 |
| -from chia.full_node.mempool_check_conditions import GENERATOR_MOD |
30 |
| -from chia.plotting.create_plots import create_plots, PlotKeys |
31 |
| -from chia.plotting.util import add_plot_directory |
32 | 22 | from chia.consensus.block_creation import unfinished_block_to_full_block
|
33 | 23 | from chia.consensus.block_record import BlockRecord
|
34 | 24 | from chia.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward
|
35 | 25 | from chia.consensus.blockchain_interface import BlockchainInterface
|
36 |
| -from chia.consensus.coinbase import create_puzzlehash_for_pk, create_farmer_coin, create_pool_coin |
| 26 | +from chia.consensus.coinbase import create_farmer_coin, create_pool_coin, create_puzzlehash_for_pk |
37 | 27 | from chia.consensus.condition_costs import ConditionCost
|
38 | 28 | from chia.consensus.constants import ConsensusConstants
|
39 | 29 | from chia.consensus.default_constants import DEFAULT_CONSTANTS
|
|
48 | 38 | is_overflow_block,
|
49 | 39 | )
|
50 | 40 | from chia.consensus.vdf_info_computation import get_signage_point_vdf_info
|
| 41 | +from chia.daemon.keychain_proxy import KeychainProxy, connect_to_keychain_and_validate, wrap_local_keychain |
| 42 | +from chia.full_node.bundle_tools import ( |
| 43 | + best_solution_generator_from_template, |
| 44 | + detect_potential_template_generator, |
| 45 | + simple_solution_generator, |
| 46 | +) |
| 47 | +from chia.full_node.generator import setup_generator_args |
| 48 | +from chia.full_node.mempool_check_conditions import GENERATOR_MOD |
51 | 49 | from chia.full_node.signage_point import SignagePoint
|
52 |
| -from chia.plotting.util import PlotsRefreshParameter, PlotRefreshResult, PlotRefreshEvents, parse_plot_info |
| 50 | +from chia.plotting.create_plots import PlotKeys, create_plots |
53 | 51 | from chia.plotting.manager import PlotManager
|
| 52 | +from chia.plotting.util import ( |
| 53 | + PlotRefreshEvents, |
| 54 | + PlotRefreshResult, |
| 55 | + PlotsRefreshParameter, |
| 56 | + add_plot_directory, |
| 57 | + parse_plot_info, |
| 58 | +) |
54 | 59 | from chia.server.server import ssl_context_for_client
|
| 60 | +from chia.simulator.socket import find_available_listen_port |
| 61 | +from chia.simulator.ssl_certs import get_next_nodes_certs_and_keys, get_next_private_ca_cert_and_key |
| 62 | +from chia.simulator.time_out_assert import time_out_assert_custom_interval |
| 63 | +from chia.simulator.wallet_tools import WalletTool |
55 | 64 | from chia.types.blockchain_format.classgroup import ClassgroupElement
|
56 | 65 | from chia.types.blockchain_format.coin import Coin, hash_coin_ids
|
57 | 66 | from chia.types.blockchain_format.foliage import Foliage, FoliageBlockData, FoliageTransactionBlock, TransactionsInfo
|
|
76 | 85 | from chia.types.unfinished_block import UnfinishedBlock
|
77 | 86 | from chia.util.bech32m import encode_puzzle_hash
|
78 | 87 | from chia.util.block_cache import BlockCache
|
79 |
| -from chia.util.config import load_config, lock_config, save_config, override_config |
| 88 | +from chia.util.config import load_config, lock_config, override_config, save_config |
80 | 89 | from chia.util.default_root import DEFAULT_ROOT_PATH
|
| 90 | +from chia.util.errors import Err |
81 | 91 | from chia.util.hash import std_hash
|
82 | 92 | from chia.util.ints import uint8, uint16, uint32, uint64, uint128
|
83 | 93 | from chia.util.keychain import Keychain, bytes_to_mnemonic
|
84 | 94 | from chia.util.prev_transaction_block import get_prev_transaction_block
|
85 | 95 | from chia.util.vdf_prover import get_vdf_info_and_proof
|
86 |
| -from tests.time_out_assert import time_out_assert_custom_interval |
87 |
| -from tests.wallet_tools import WalletTool |
88 |
| -from tests.util.socket import find_available_listen_port |
89 |
| -from tests.util.ssl_certs import get_next_nodes_certs_and_keys, get_next_private_ca_cert_and_key |
90 | 96 | from chia.wallet.derive_keys import (
|
91 | 97 | master_sk_to_farmer_sk,
|
92 | 98 | master_sk_to_local_sk,
|
93 | 99 | master_sk_to_pool_sk,
|
94 | 100 | master_sk_to_wallet_sk,
|
95 | 101 | )
|
96 |
| -from chia_rs import compute_merkle_set_root |
97 | 102 |
|
98 | 103 | test_constants = DEFAULT_CONSTANTS.replace(
|
99 | 104 | **{
|
@@ -215,7 +220,7 @@ def test_callback(event: PlotRefreshEvents, update_result: PlotRefreshResult):
|
215 | 220 | self.total_result.loaded += update_result.loaded
|
216 | 221 | self.total_result.processed += update_result.processed
|
217 | 222 | self.total_result.duration += update_result.duration
|
218 |
| - assert update_result.remaining == len(self.expected_plots) - self.total_result.processed |
| 223 | + assert update_result.remaining >= len(self.expected_plots) - self.total_result.processed |
219 | 224 | assert len(update_result.loaded) <= self.plot_manager.refresh_parameter.batch_size
|
220 | 225 |
|
221 | 226 | if event == PlotRefreshEvents.done:
|
@@ -269,7 +274,10 @@ async def setup_keys(self, fingerprint: Optional[int] = None, reward_ph: Optiona
|
269 | 274 | else:
|
270 | 275 | self.farmer_ph = reward_ph
|
271 | 276 | self.pool_ph = reward_ph
|
272 |
| - self.all_sks: List[PrivateKey] = [sk for sk, _ in await self.keychain_proxy.get_all_private_keys()] |
| 277 | + if self.automated_testing: |
| 278 | + self.all_sks: List[PrivateKey] = [sk for sk, _ in await self.keychain_proxy.get_all_private_keys()] |
| 279 | + else: |
| 280 | + self.all_sks = [self.farmer_master_sk] # we only want to include plots under the same fingerprint |
273 | 281 | self.pool_pubkeys: List[G1Element] = [master_sk_to_pool_sk(sk).get_g1() for sk in self.all_sks]
|
274 | 282 |
|
275 | 283 | self.farmer_pubkeys: List[G1Element] = [master_sk_to_farmer_sk(sk).get_g1() for sk in self.all_sks]
|
|
0 commit comments