Skip to content

Commit 6e60202

Browse files
committed
feat: add Network._get_node() and update executable to support node selection
Signed-off-by: Angelina <[email protected]>
1 parent 5f694bd commit 6e60202

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ This changelog is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.
2121
- Added expiration_time, auto_renew_period, auto_renew_account, fee_schedule_key, kyc_key in `TokenCreateTransaction`, `TokenUpdateTransaction` classes
2222
- Added comprehensive Google-style docstrings to the `CustomFee` class and its methods in `custom_fee.py`.
2323
- docs: Add `docs/sdk_developers/project_structure.md` to explain repository layout and import paths.
24+
- Support selecting specific node account ID(s) for queries and transactions (#362)
25+
- Added `Network._get_node()` method and updated execution flow to use node selection (#362)
2426

2527
### Changed
2628
- chore: validate that token airdrop transactions require an available token service on the channel (#632)

src/hiero_sdk_python/client/network.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,21 @@ def _select_node(self) -> _Node:
171171
self._node_index = (self._node_index + 1) % len(self.nodes)
172172
self.current_node = self.nodes[self._node_index]
173173
return self.current_node
174+
175+
def _get_node(self, account_id: AccountId) -> Optional[_Node]:
176+
"""
177+
Get a node matching the given account ID.
178+
179+
Args:
180+
account_id (AccountId): The account ID of the node to locate.
181+
182+
Returns:
183+
Optional[_Node]: The matching node, or None if not found.
184+
"""
185+
for node in self.nodes:
186+
if node._account_id == account_id:
187+
return node
188+
return None
174189

175190
def get_mirror_address(self) -> str:
176191
"""

src/hiero_sdk_python/executable.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ def _execute(self, client: "Client"):
183183
)
184184

185185
self.node_account_id = selected_node_account_id
186-
node = client.network._select_node(self.node_account_id)
186+
node = client.network._get_node(self.node_account_id)
187187

188188
# Create a channel wrapper from the client's channel
189189
channel = node._get_channel()

0 commit comments

Comments
 (0)