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:
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…
Reference in New Issue
Block a user