1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Fix migration 47 (#9014)

This migration had referred to the non-existent
`TransactionsController` instead of `TransactionController`, so it
effectively did nothing. Now it should work.

This migration hasn't been included in any release yet, so we can fix
it in-place instead of adding an additional corrected migration.

The migration comment has also been updated, as it was inaccurate.
This commit is contained in:
Mark Stacey 2020-07-16 10:16:41 -03:00 committed by GitHub
parent b97cd1dc04
commit 022ef13372
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 9 deletions

View File

@ -2,9 +2,7 @@ const version = 47
import { cloneDeep } from 'lodash'
/**
* Stringify numbers:
* - PreferencesController.frequentRpcListDetail item chainId
* - TransactionsController.transactions item metamaskNetworkId
* Stringify the `metamaskNetworkId` property of all transactions
*/
export default {
version,
@ -18,7 +16,7 @@ export default {
}
function transformState (state) {
const transactions = state?.TransactionsController?.transactions
const transactions = state?.TransactionController?.transactions
if (Array.isArray(transactions)) {
transactions.forEach((transaction) => {
if (typeof transaction.metamaskNetworkId === 'number') {

View File

@ -20,7 +20,7 @@ describe('migration #47', function () {
const oldStorage = {
meta: {},
data: {
TransactionsController: {
TransactionController: {
transactions: [
{ foo: 'bar', metamaskNetworkId: 2 },
{ foo: 'bar' },
@ -34,7 +34,7 @@ describe('migration #47', function () {
const newStorage = await migration47.migrate(oldStorage)
assert.deepEqual(newStorage.data, {
TransactionsController: {
TransactionController: {
transactions: [
{ foo: 'bar', metamaskNetworkId: '2' },
{ foo: 'bar' },
@ -50,7 +50,7 @@ describe('migration #47', function () {
const oldStorage = {
meta: {},
data: {
TransactionsController: {
TransactionController: {
transactions: [
{ foo: 'bar', metamaskNetworkId: '2' },
{ foo: 'bar' },
@ -70,7 +70,7 @@ describe('migration #47', function () {
const oldStorage = {
meta: {},
data: {
TransactionsController: {
TransactionController: {
bar: 'baz',
},
foo: 'bar',
@ -85,7 +85,7 @@ describe('migration #47', function () {
const oldStorage = {
meta: {},
data: {
TransactionsController: {
TransactionController: {
transactions: [],
bar: 'baz',
},