XRPLF / rippled

Decentralized cryptocurrency blockchain daemon implementing the XRP Ledger protocol in C++
https://xrpl.org
ISC License
4.53k stars 1.47k forks source link

LastLedgerSequence error #4248

Open lijianl opened 2 years ago

lijianl commented 2 years ago

send xrp always get error:

let tx = {
        Fee: xrpMAP.tx_cost,
        TransactionType: 'Payment',
        Account: fromAddress,
        Amount: xrpl.xrpToDrops(amtXRP),
        Destination: toAddress,
        LastLedgerSequence: validated_ledger + 77, // 2 mins to confirm
        Memos: [
            {Memo: {MemoData: xrpl.convertStringToHex(recordId)}},
            {Memo: {MemoData: xrpl.convertStringToHex(tagInt)}},
        ]
    }
    if (tagInt) {
        tx.DestinationTag = parseInt(tagInt); // int need
    }
    console.log(`xrp-send-data-${JSON.stringify(tx)},${recordId}`);
    let res = await client.submitAndWait(tx, {
        autofill: true,
        failHard: true,
        wallet: fromWallet,
    }).then(res => res.result).catch(err => console.log(`xrp-send-error-${recordId}`, err));

always return error XrplError: The latest ledger sequence 73215626 is greater than the transaction's LastLedgerSequence (73215625).

how to optimize this

lijianl commented 2 years ago
  1. upgrade tx cost to 15 drops.
  2. LastLedgerSequence = validated_ledger got from server_state then add 77
  3. using ws endpoint => wss://xrplcluster.com/.
  4. after the submitAndWait called, the response will cost 4mins to return, why cost so many time at here

still always return error, what should i do or where to optimize

mvadari commented 1 year ago

The relevant xrpl.js issue was closed: https://github.com/XRPLF/xrpl.js/issues/2052 so I think this issue can also be closed.