1
0
mirror of https://github.com/trezor/trezor-wallet synced 2024-11-24 09:18:09 +00:00

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

This commit is contained in:
Szymon Lesisz 2018-05-29 11:50:31 +02:00
parent 148a61645f
commit 726a41fb8c
2 changed files with 3 additions and 3 deletions

View File

@ -855,9 +855,9 @@ export const onSend = (): AsyncAction => {
const pendingAmount: BigNumber = stateUtils.getPendingAmount(pending, currentState.currency); const pendingAmount: BigNumber = stateUtils.getPendingAmount(pending, currentState.currency);
const pendingNonce: number = stateUtils.getPendingNonce(pending); 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 = { const txData = {
address_n, address_n,

View File

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