hedera-sdk-go icon indicating copy to clipboard operation
hedera-sdk-go copied to clipboard

ClientForNetwork blocks for 10 seconds

Open xin-hedera opened this issue 2 years ago • 1 comments

Description

hedera.ClientForNetwork(network map[string]AccountID) blocks for 10 seconds, problem is the call CancelScheduledNetworkUpdate() will block on sending to the channel since the reader goroutine has an initial 10-sec sleep.

In addition, though out of the scope of this ticket, we should provide a feature flag to disable retrieving address book from mirrornode since it's possible the SDK is used in an isolated network without access to internet.

Update: just realized there is a bigger issue in the changes for hedera.ClientForNetwork: why would the sdk assume network name is mainnet? If someone pass testnet nodes to hedera.ClientForNetwork, in a while, when the address book update kicks in, it'll switch to mainnet nodes.

Steps to reproduce

as in the description

Additional context

No response

Hedera network

testnet

Version

v2.17.4

Operating system

No response

xin-hedera avatar Sep 26 '22 17:09 xin-hedera

After a few discussions on this issue, we can conclude the following:

  • The 10 second delay should not be present and has been added wrongfully. This is currently being addressed while at the same time providing a solution for the test architecture which is currently relying on the 10 second delay.
  • Regarding the issue with the name <> ledgerID I have logged an issue: https://github.com/hashgraph/hedera-sdk-go/issues/603 for us to address separately

Kalina-Todorova avatar Oct 21 '22 11:10 Kalina-Todorova