Skip to content
New issue

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

RawSendV2 waitingConfirmation is not usefull. #270

Open
ok1d opened this issue Jun 26, 2024 · 5 comments
Open

RawSendV2 waitingConfirmation is not usefull. #270

ok1d opened this issue Jun 26, 2024 · 5 comments

Comments

@ok1d
Copy link

ok1d commented Jun 26, 2024

func (w *Wallet) RawSendV2(

for ; time.Since(t) < waitingConfirmation; time.Sleep(waitingConfirmation / 10) {
	newSeqno, err := w.blockchain.GetSeqno(ctx, w.address)
	if err == nil {
		continue
	}
	if newSeqno >= seqno {
		return msgHash, nil //todo: check if it is the same message
	}
}

should be

for ; time.Since(t) < waitingConfirmation; time.Sleep(waitingConfirmation / 10) {
	newSeqno, err := w.blockchain.GetSeqno(ctx, w.address)
	if err != nil {
		continue
	}
	if newSeqno > seqno {
		return msgHash, nil //todo: check if it is the same message
	}
}
@Jazzoe
Copy link

Jazzoe commented Jul 25, 2024

you can wrapper it for youself, here is a demo

` for {
select {
case <-ctx.Done():
return ctx.Err()
case <-time.Tick(maxWaitTime):
return errors.New("wait transaction confirm timeout")
default:
getSeqno, err := client.GetSeqno(ctx, accountID)
switch {
case errors.Is(err, liteapi.ErrAccountNotFound):
getSeqno = 0
case err != nil:
return err
}

		if int64(getSeqno) > seqno {
			return nil
		}

		time.Sleep(1 * time.Second)
	}
}`

@Mohsiareej
Copy link

user_agreement.pdf
Holla #

@Mohsiareej
Copy link

Holla way hurry

@Mohsiareej
Copy link

Holla

@Mohsiareej
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants