diff --git a/helper/call.go b/helper/call.go index 9dfb1d7f..df98b25c 100644 --- a/helper/call.go +++ b/helper/call.go @@ -1136,7 +1136,7 @@ func (c *ContractCaller) GetSyncedCheckpointId(contractAddress string, rootChain } // Call - data, err := c.TronChainRPC.TriggerConstantContract(contractAddress, btsPack) + data, err := c.TronChainRPC.TriggerConstantContractWithRetry(contractAddress, btsPack) if err != nil { return 0, err } diff --git a/tron/tronclient.go b/tron/tronclient.go index d937dd01..e431608d 100644 --- a/tron/tronclient.go +++ b/tron/tronclient.go @@ -3,6 +3,7 @@ package tron import ( "context" "fmt" + "github.com/ethereum/go-ethereum/log" "math/big" "os" "strings" @@ -90,13 +91,15 @@ func (tc *Client) TriggerConstantContractWithRetry(contractAddress string, data response, err = tc.TriggerConstantContract(contractAddress, data) if err == nil && response != nil { + log.Info("Successfully trigger tron constant contract", "attempt", attempt) break } + log.Error("Failed to trigger tron constant contract", + "err", err, "attempt", attempt, "maxRetries", maxRetries) if attempt < maxRetries-1 { delay := attempt + 1 time.Sleep(time.Duration(delay) * time.Second) } - } return response, err }