Autofill: use current ledger for sequence number (#1719)

Getting an account's next available sequence number is a case where using the open ledger usually makes more sense than getting the validated ledger. If you have any transactions pending, the sequence from the validated ledger will be behind, but one from the open ledger will be correct unless the pending transactions fail to achieve a consensus (which is rare).
This commit is contained in:
Rome Reginelli
2021-10-14 12:15:04 -07:00
committed by GitHub
parent 943c043c0b
commit 5eb3db5395

View File

@@ -127,7 +127,7 @@ async function setNextValidSequenceNumber(
const request: AccountInfoRequest = {
command: 'account_info',
account: tx.Account,
ledger_index: 'validated',
ledger_index: 'current',
}
const data = await client.request(request)
// eslint-disable-next-line no-param-reassign, require-atomic-updates -- param reassign is safe with no race condition