Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow for connections to different hosts for wallet and full node #265

Merged
merged 2 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/api/dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ async def _get_rpc_client(
async def get_wallet_rpc_client() -> AsyncIterator[WalletRpcClient]:
async for _ in _get_rpc_client(
node_type=NodeType.WALLET,
self_hostname=settings.CHIA_HOSTNAME,
self_hostname=settings.CHIA_WALLET_HOSTNAME or settings.CHIA_HOSTNAME,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would write this using ternary
self_hostname = setting.CHIA_WALLET_HOSTNAME if setting.CHIA_WALLET_HOSTNAME else settings.CHIA_HOSTNAME

although I'm not sure I have a good reason for it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have a good reason for the way I was doing it either, so I changed it to your suggestion

rpc_port=settings.CHIA_WALLET_RPC_PORT,
root_path=settings.CHIA_ROOT,
):
Expand All @@ -88,7 +88,7 @@ async def get_wallet_rpc_client() -> AsyncIterator[WalletRpcClient]:
async def get_full_node_rpc_client() -> AsyncIterator[FullNodeRpcClient]:
async for _ in _get_rpc_client(
node_type=NodeType.FULL_NODE,
self_hostname=settings.CHIA_HOSTNAME,
self_hostname=settings.CHIA_FULL_NODE_HOSTNAME or settings.CHIA_HOSTNAME,
rpc_port=settings.CHIA_FULL_NODE_RPC_PORT,
root_path=settings.CHIA_ROOT,
):
Expand Down
2 changes: 2 additions & 0 deletions app/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ class Settings(BaseSettings):
CADT_API_SERVER_HOST: str = "https://observer.climateactiondata.org/api"
CADT_API_KEY: Optional[str] = None
CHIA_HOSTNAME: str = "localhost"
CHIA_WALLET_HOSTNAME: Optional[str] = None
CHIA_FULL_NODE_HOSTNAME: Optional[str] = None
CHIA_FULL_NODE_RPC_PORT: int = 8555
CHIA_WALLET_RPC_PORT: int = 9256
CLIMATE_EXPLORER_PORT: Optional[int] = None
Expand Down
2 changes: 2 additions & 0 deletions config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ MIN_DEPTH: 4
CADT_API_SERVER_HOST: https://observer.climateactiondata.org/api
CADT_API_KEY:
CHIA_HOSTNAME: localhost
CHIA_WALLET_HOSTNAME: ""
CHIA_FULL_NODE_HOSTNAME: ""
CHIA_FULL_NODE_RPC_PORT: 8555
CHIA_WALLET_RPC_PORT: 9256
DEFAULT_FEE: 1000000000 # mojos
Expand Down
Loading