rippled
rippled copied to clipboard
LastLedgerSequence error
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
- upgrade tx cost to 15 drops.
- LastLedgerSequence = validated_ledger got from server_state then add 77
- using ws endpoint => wss://xrplcluster.com/.
- after the
submitAndWaitcalled, 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
The relevant xrpl.js issue was closed: https://github.com/XRPLF/xrpl.js/issues/2052 so I think this issue can also be closed.