sets up wallet before running farm summary (#3235)

* sets up wallet before running farm summary

* fixes call to summary

* moves wallet peers discovery to after backup is initialized
This commit is contained in:
Will Bendick 2021-05-18 11:38:06 -07:00 committed by GitHub
parent 1c808b6c29
commit 880df53f72
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 3 deletions

View File

@ -47,11 +47,23 @@ def farm_cmd() -> None:
default=None,
show_default=True,
)
def summary_cmd(rpc_port: int, wallet_rpc_port: int, harvester_rpc_port: int, farmer_rpc_port: int) -> None:
@click.option("-f", "--fingerprint", help="Set the fingerprint to specify which wallet to use", type=int)
def summary_cmd(
rpc_port: int, wallet_rpc_port: int, harvester_rpc_port: int, farmer_rpc_port: int, fingerprint: int
) -> None:
from .farm_funcs import summary
import asyncio
asyncio.run(summary(rpc_port, wallet_rpc_port, harvester_rpc_port, farmer_rpc_port))
from .wallet_funcs import execute_with_wallet
asyncio.run(
execute_with_wallet(
wallet_rpc_port,
fingerprint,
{},
lambda *ignored: summary(rpc_port, wallet_rpc_port, harvester_rpc_port, farmer_rpc_port),
)
)
@farm_cmd.command("challenges", short_help="Show the latest challenges")

View File

@ -194,6 +194,7 @@ class WalletNode:
self.sync_task = asyncio.create_task(self.sync_job())
self.logged_in_fingerprint = fingerprint
self.logged_in = True
asyncio.create_task(self.wallet_peers.start())
return True
def _close(self):
@ -314,7 +315,6 @@ class WalletNode:
self.config["peer_connect_interval"],
self.log,
)
asyncio.create_task(self.wallet_peers.start())
async def on_connect(self, peer: WSChiaConnection):
if self.wallet_state_manager is None or self.backup_initialized is False: