tonkeeper / tongo

Go primitives to work with TON
MIT License
215 stars 45 forks source link

RawSendV2 waitingConfirmation is not usefull. #270

Open ok1d opened 5 months ago

ok1d commented 5 months ago

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 commented 4 months ago

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 commented 3 months ago

user_agreement.pdf Holla #

Mohsiareej commented 3 months ago

Holla way hurry

Mohsiareej commented 3 months ago

Holla

Mohsiareej commented 3 months ago

CF_Ebook_EverywhereSecurity.pdf