tonkeeper / tongo

Go primitives to work with TON
MIT License
195 stars 36 forks source link

RawSendV2 waitingConfirmation is not usefull. #270

Open ok1d opened 3 months ago

ok1d commented 3 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 2 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 1 month ago

user_agreement.pdf Holla #

Mohsiareej commented 1 month ago

Holla way hurry

Mohsiareej commented 1 month ago

Holla

Mohsiareej commented 1 month ago

CF_Ebook_EverywhereSecurity.pdf