diff --git a/account_balance_query_e2e_test.go b/account_balance_query_e2e_test.go index 5e7f5c07..a0646209 100644 --- a/account_balance_query_e2e_test.go +++ b/account_balance_query_e2e_test.go @@ -207,6 +207,7 @@ func TestIntegrationAccountBalanceQueryWorksWithHollowAccountAlias(t *testing.T) } func TestIntegrationAccountBalanceQueryCanConnectToMainnetTls(t *testing.T) { + t.Skip("AccountBalanceQuery is throttled on mainnet") t.Parallel() client := ClientForMainnet() client.SetTransportSecurity(true) diff --git a/executable.go b/executable.go index b46f3b73..b9c5b959 100644 --- a/executable.go +++ b/executable.go @@ -26,8 +26,6 @@ import ( "strconv" "time" - "github.com/cenkalti/backoff/v4" - protobuf "google.golang.org/protobuf/proto" "github.com/pkg/errors" @@ -191,12 +189,9 @@ func (e *executable) getNodeAccountID() AccountID { return e.nodeAccountIDs._GetCurrent().(AccountID) } +// nolint func _Execute(client *Client, e Executable) (interface{}, error) { var maxAttempts int - backOff := backoff.NewExponentialBackOff() - backOff.InitialInterval = e.GetMinBackoff() - backOff.MaxInterval = e.GetMaxBackoff() - backOff.Multiplier = 2 if client.maxAttempts != nil { maxAttempts = *client.maxAttempts @@ -213,11 +208,16 @@ func _Execute(client *Client, e Executable) (interface{}, error) { txLogger := e.getLogger(client.logger) txID, msg := e.getTransactionIDAndMessage() - for attempt = int64(0); attempt < int64(maxAttempts); attempt, currentBackoff = attempt+1, currentBackoff*2 { + for attempt = int64(0); attempt < int64(maxAttempts); attempt++ { var protoRequest interface{} var node *_Node var ok bool + // If this is not the first attempt, double the backoff time up to the max backoff time + if attempt > 0 && currentBackoff <= e.GetMaxBackoff() { + currentBackoff *= 2 + } + if e.isTransaction() { if attempt > 0 && len(e.GetNodeAccountIDs()) > 1 { e.advanceRequest() diff --git a/go.mod b/go.mod index 0802b15c..f1430d80 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,6 @@ go 1.21 require ( github.com/btcsuite/btcd/btcec/v2 v2.3.4 - github.com/cenkalti/backoff/v4 v4.3.0 github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 github.com/json-iterator/go v1.1.12 github.com/mitchellh/mapstructure v1.5.0 diff --git a/go.sum b/go.sum index 00095c7d..c164e80a 100644 --- a/go.sum +++ b/go.sum @@ -2,8 +2,6 @@ github.com/btcsuite/btcd/btcec/v2 v2.3.4 h1:3EJjcN70HCu/mwqlUsGK8GcNVyLVxFDlWurT github.com/btcsuite/btcd/btcec/v2 v2.3.4/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= -github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8= -github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= diff --git a/tck/go.mod b/tck/go.mod index 9d482a5b..4db46cef 100644 --- a/tck/go.mod +++ b/tck/go.mod @@ -13,7 +13,6 @@ replace github.com/hashgraph/hedera-sdk-go/v2 => ../ require ( github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect - github.com/cenkalti/backoff/v4 v4.3.0 // indirect github.com/creachadair/mds v0.3.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect diff --git a/tck/go.sum b/tck/go.sum index 1bb948b6..9001f6ab 100644 --- a/tck/go.sum +++ b/tck/go.sum @@ -2,8 +2,6 @@ github.com/btcsuite/btcd/btcec/v2 v2.3.4 h1:3EJjcN70HCu/mwqlUsGK8GcNVyLVxFDlWurT github.com/btcsuite/btcd/btcec/v2 v2.3.4/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= -github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8= -github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/creachadair/jrpc2 v1.1.2 h1:UOYMipEFYlwd5qmcvs9GZBurn3oXt1UDIX5JLjWWFzo= github.com/creachadair/jrpc2 v1.1.2/go.mod h1:JcCe2Eny3lIvVwZLm92WXyU+tNUgTBWFCLMsfNkjEGk=