1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-27 04:46:10 +01:00
metamask-extension/test/unit/app/controllers/transactions
Mark Stacey 5b5b67a985
Fix default gas race condition (#8490)
A race condition exists where after adding an unapproved transaction,
it could be mutated and then replaced when the default gas parameters
are set. This happens because the transaction is added to state and
broadcast before the default gas parameters are set, because
calculating the default gas parameters to use takes some time.
Once they've been calculated, the false assumption was made that the
transaction hadn't changed.

The method responsible for setting the default gas now retrieves an
up-to-date copy of `txMeta`, and conditionally sets the defaults only
if they haven't yet been set.

This race condition was introduced in #2962, though that PR also added
a loading screen that avoided this issue by preventing the user from
interacting with the transaction until after the gas had been
estimated. Unfortunately this loading screen was not carried forward to
the new UI.
2020-05-01 12:25:45 -03:00
..
pending-tx-tracker-test.js Mark PendingTransactionTracker#resubmitPendingTxs as async (#8399) 2020-04-27 13:24:39 -02:30
recipient-blacklist-checker-test.js Rename recipientBlacklistChecker function (#8365) 2020-04-20 16:29:41 -02:30
tx-controller-test.js Fix default gas race condition (#8490) 2020-05-01 12:25:45 -03:00
tx-gas-util-test.js Tidy up transaction-related unit tests (#8362) 2020-04-20 12:31:00 -02:30
tx-helper-test.js Tidy up transaction-related unit tests (#8362) 2020-04-20 12:31:00 -02:30
tx-state-history-helpers-test.js Export individual fns from tx-state-history-helpers (#8370) 2020-04-20 13:00:51 -02:30
tx-state-manager-test.js Skip adding history entry for empty txMeta diffs (#8379) 2020-04-22 11:09:16 +08:00
tx-utils-test.js Tidy up transaction-related unit tests (#8362) 2020-04-20 12:31:00 -02:30