fix: nonce count when account.nonce == 0 && pending.length == 0

pull/2/merge
Szymon Lesisz 6 years ago
parent 148a61645f
commit 726a41fb8c

@ -855,9 +855,9 @@ export const onSend = (): AsyncAction => {
const pendingAmount: BigNumber = stateUtils.getPendingAmount(pending, currentState.currency);
const pendingNonce: number = stateUtils.getPendingNonce(pending);
const nonce = pendingNonce >= account.nonce ? pendingNonce + 1 : account.nonce;
const nonce = pendingNonce > 0 && pendingNonce >= account.nonce ? pendingNonce : account.nonce;
console.warn("NONCE", nonce, account.nonce, stateUtils.getPendingNonce(pending))
console.warn("NONCE", nonce, account.nonce, pendingNonce)
const txData = {
address_n,

@ -94,7 +94,7 @@ export const getAccountPendingTx = (pending: Array<PendingTx>, account: ?Account
export const getPendingNonce = (pending: Array<PendingTx>): number => {
return pending.reduce((value: number, tx: PendingTx) => {
if (tx.rejected) return value;
return Math.max(value, tx.nonce);
return Math.max(value, tx.nonce + 1);
}, 0);
}

Loading…
Cancel
Save