mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Delete localhost state from incoming tx controller (#9569)
This commit is contained in:
parent
f9e0c64abe
commit
4ce04b5cb9
@ -11,6 +11,7 @@ const version = 48
|
||||
* 4. Delete CachedBalancesController.cachedBalances
|
||||
* 5. Convert transactions metamaskNetworkId to decimal if they are hex
|
||||
* 6. Convert address book keys from decimal to hex
|
||||
* 7. Delete localhost key in IncomingTransactionsController
|
||||
*/
|
||||
export default {
|
||||
version,
|
||||
@ -104,6 +105,11 @@ function transformState (state = {}) {
|
||||
}
|
||||
})
|
||||
|
||||
// 7. Delete localhost key in IncomingTransactionsController
|
||||
delete state.IncomingTransactionsController
|
||||
?.incomingTxLastFetchedBlocksByNetwork
|
||||
?.localhost
|
||||
|
||||
return state
|
||||
}
|
||||
|
||||
|
@ -518,4 +518,61 @@ describe('migration #48', function () {
|
||||
foo: 'bar',
|
||||
})
|
||||
})
|
||||
|
||||
it('should delete localhost key in IncomingTransactionsController', async function () {
|
||||
const oldStorage = {
|
||||
meta: {},
|
||||
data: {
|
||||
IncomingTransactionsController: {
|
||||
incomingTxLastFetchedBlocksByNetwork: {
|
||||
fizz: 'buzz',
|
||||
localhost: {},
|
||||
},
|
||||
bar: 'baz',
|
||||
},
|
||||
foo: 'bar',
|
||||
},
|
||||
}
|
||||
|
||||
const newStorage = await migration48.migrate(oldStorage)
|
||||
assert.deepEqual(newStorage.data, {
|
||||
...expectedPreferencesState,
|
||||
IncomingTransactionsController: {
|
||||
incomingTxLastFetchedBlocksByNetwork: {
|
||||
fizz: 'buzz',
|
||||
},
|
||||
bar: 'baz',
|
||||
},
|
||||
foo: 'bar',
|
||||
})
|
||||
})
|
||||
|
||||
it('should not modify IncomingTransactionsController state if affected key is missing', async function () {
|
||||
const oldStorage = {
|
||||
meta: {},
|
||||
data: {
|
||||
IncomingTransactionsController: {
|
||||
incomingTxLastFetchedBlocksByNetwork: {
|
||||
fizz: 'buzz',
|
||||
rpc: {},
|
||||
},
|
||||
bar: 'baz',
|
||||
},
|
||||
foo: 'bar',
|
||||
},
|
||||
}
|
||||
|
||||
const newStorage = await migration48.migrate(oldStorage)
|
||||
assert.deepEqual(newStorage.data, {
|
||||
...expectedPreferencesState,
|
||||
IncomingTransactionsController: {
|
||||
incomingTxLastFetchedBlocksByNetwork: {
|
||||
fizz: 'buzz',
|
||||
rpc: {},
|
||||
},
|
||||
bar: 'baz',
|
||||
},
|
||||
foo: 'bar',
|
||||
})
|
||||
})
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user