Skip to content

Commit 13a542a

Browse files
committed
feat: add Network._get_node() and update executable to support node selection
Signed-off-by: Angelina <aceppaluni@gmail.com>
1 parent dac9cd2 commit 13a542a

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
@@ -64,6 +64,8 @@ This changelog is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.
6464
- Added expiration_time, auto_renew_period, auto_renew_account, fee_schedule_key, kyc_key in `TokenCreateTransaction`, `TokenUpdateTransaction` classes
6565
- Added comprehensive Google-style docstrings to the `CustomFee` class and its methods in `custom_fee.py`.
6666
- docs: Add `docs/sdk_developers/project_structure.md` to explain repository layout and import paths.
67+
- Support selecting specific node account ID(s) for queries and transactions (#362)
68+
- Added `Network._get_node()` method and updated execution flow to use node selection (#362)
6769

6870
### Changed
6971
- chore: bumped solo action from 14.0 to 15.0 (#764)

src/hiero_sdk_python/client/network.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,21 @@ def _select_node(self) -> _Node:
177177
self._node_index = (self._node_index + 1) % len(self.nodes)
178178
self.current_node = self.nodes[self._node_index]
179179
return self.current_node
180+
181+
def _get_node(self, account_id: AccountId) -> Optional[_Node]:
182+
"""
183+
Get a node matching the given account ID.
184+
185+
Args:
186+
account_id (AccountId): The account ID of the node to locate.
187+
188+
Returns:
189+
Optional[_Node]: The matching node, or None if not found.
190+
"""
191+
for node in self.nodes:
192+
if node._account_id == account_id:
193+
return node
194+
return None
180195

181196
def get_mirror_address(self) -> str:
182197
"""

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)