We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
code:
func (rc NodeClient) PollForTransaction(hash string, options ...any) (api.UserTransaction, error) { period, timeout, err := getTransactionPollOptions(100time.Millisecond, 10time.Second, options...) if err != nil { return nil, err } start := time.Now() deadline := start.Add(timeout) for { if time.Now().After(deadline) { return nil, errors.New("PollForTransaction timeout") } time.Sleep(period) txn, err := rc.TransactionByHash(hash) if err == nil { if txn.Type == api.TransactionVariantPending { // not done yet! } else if txn.Type == api.TransactionVariantUser { // done! slog.Debug("txn done", "hash", hash) return txn.UserTransaction() } } } }
在这里面去轮询hash获取信息时,如果交易很慢,就会轮询失败,导致状态判断错误,
The text was updated successfully, but these errors were encountered:
Does increasing the timeout fix your problem? (Also, if this is in the docs, can you link to the page which you think should change?)
Translated with AI / 由AI翻译: 增加超时时间能解决你的问题吗?另外,如果这在文档中有提到,你能链接到你认为需要修改的页面吗?
Sorry, something went wrong.
可以解决我的问题,我这提的问题是在GoSDK里面,有个地方关于超时时间设置的不是很合理
No branches or pull requests
Aptos Documentation Issue
Location
code:
func (rc NodeClient) PollForTransaction(hash string, options ...any) (api.UserTransaction, error) {
period, timeout, err := getTransactionPollOptions(100time.Millisecond, 10time.Second, options...)
if err != nil {
return nil, err
}
start := time.Now()
deadline := start.Add(timeout)
for {
if time.Now().After(deadline) {
return nil, errors.New("PollForTransaction timeout")
}
time.Sleep(period)
txn, err := rc.TransactionByHash(hash)
if err == nil {
if txn.Type == api.TransactionVariantPending {
// not done yet!
} else if txn.Type == api.TransactionVariantUser {
// done!
slog.Debug("txn done", "hash", hash)
return txn.UserTransaction()
}
}
}
}
Description
在这里面去轮询hash获取信息时,如果交易很慢,就会轮询失败,导致状态判断错误,
The text was updated successfully, but these errors were encountered: