mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Merge branch 'master' into i1805-LiveBlacklistUpdating
This commit is contained in:
commit
f147b928b2
@ -2,6 +2,9 @@
|
|||||||
|
|
||||||
## Current Master
|
## Current Master
|
||||||
|
|
||||||
|
## 3.9.2 2017-7-26
|
||||||
|
|
||||||
|
- Fix bugs that could sometimes result in failed transactions after switching networks.
|
||||||
- Include stack traces in txMeta's to better understand the life cycle of transactions
|
- Include stack traces in txMeta's to better understand the life cycle of transactions
|
||||||
|
|
||||||
## 3.9.1 2017-7-19
|
## 3.9.1 2017-7-19
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "MetaMask",
|
"name": "MetaMask",
|
||||||
"short_name": "Metamask",
|
"short_name": "Metamask",
|
||||||
"version": "3.9.1",
|
"version": "3.9.2",
|
||||||
"manifest_version": 2,
|
"manifest_version": 2,
|
||||||
"author": "https://metamask.io",
|
"author": "https://metamask.io",
|
||||||
"description": "Ethereum Browser Extension",
|
"description": "Ethereum Browser Extension",
|
||||||
|
@ -24,7 +24,6 @@ module.exports = class TransactionController extends EventEmitter {
|
|||||||
this.blockTracker = opts.blockTracker
|
this.blockTracker = opts.blockTracker
|
||||||
this.nonceTracker = new NonceTracker({
|
this.nonceTracker = new NonceTracker({
|
||||||
provider: this.provider,
|
provider: this.provider,
|
||||||
blockTracker: this.provider._blockTracker,
|
|
||||||
getPendingTransactions: (address) => {
|
getPendingTransactions: (address) => {
|
||||||
return this.getFilteredTxList({
|
return this.getFilteredTxList({
|
||||||
from: address,
|
from: address,
|
||||||
|
@ -4,8 +4,8 @@ const Mutex = require('await-semaphore').Mutex
|
|||||||
|
|
||||||
class NonceTracker {
|
class NonceTracker {
|
||||||
|
|
||||||
constructor ({ blockTracker, provider, getPendingTransactions }) {
|
constructor ({ provider, getPendingTransactions }) {
|
||||||
this.blockTracker = blockTracker
|
this.provider = provider
|
||||||
this.ethQuery = new EthQuery(provider)
|
this.ethQuery = new EthQuery(provider)
|
||||||
this.getPendingTransactions = getPendingTransactions
|
this.getPendingTransactions = getPendingTransactions
|
||||||
this.lockMap = {}
|
this.lockMap = {}
|
||||||
@ -39,16 +39,17 @@ class NonceTracker {
|
|||||||
assert(Number.isInteger(nextNonce), `nonce-tracker - nextNonce is not an integer - got: (${typeof nextNonce}) "${nextNonce}"`)
|
assert(Number.isInteger(nextNonce), `nonce-tracker - nextNonce is not an integer - got: (${typeof nextNonce}) "${nextNonce}"`)
|
||||||
// collect the numbers used to calculate the nonce for debugging
|
// collect the numbers used to calculate the nonce for debugging
|
||||||
const blockNumber = currentBlock.number
|
const blockNumber = currentBlock.number
|
||||||
const nonceDetails = { blockNumber, baseCount, pendingCount }
|
const nonceDetails = { blockNumber, baseCount, baseCountHex, pendingCount }
|
||||||
// return nonce and release cb
|
// return nonce and release cb
|
||||||
return { nextNonce, nonceDetails, releaseLock }
|
return { nextNonce, nonceDetails, releaseLock }
|
||||||
}
|
}
|
||||||
|
|
||||||
async _getCurrentBlock () {
|
async _getCurrentBlock () {
|
||||||
const currentBlock = this.blockTracker.getCurrentBlock()
|
const blockTracker = this._getBlockTracker()
|
||||||
|
const currentBlock = blockTracker.getCurrentBlock()
|
||||||
if (currentBlock) return currentBlock
|
if (currentBlock) return currentBlock
|
||||||
return await Promise((reject, resolve) => {
|
return await Promise((reject, resolve) => {
|
||||||
this.blockTracker.once('latest', resolve)
|
blockTracker.once('latest', resolve)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,6 +83,12 @@ class NonceTracker {
|
|||||||
return mutex
|
return mutex
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// this is a hotfix for the fact that the blockTracker will
|
||||||
|
// change when the network changes
|
||||||
|
_getBlockTracker () {
|
||||||
|
return this.provider._blockTracker
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = NonceTracker
|
module.exports = NonceTracker
|
||||||
|
@ -18,11 +18,13 @@ describe('Nonce Tracker', function () {
|
|||||||
|
|
||||||
|
|
||||||
getPendingTransactions = () => pendingTxs
|
getPendingTransactions = () => pendingTxs
|
||||||
provider = { sendAsync: (_, cb) => { cb(undefined, {result: '0x0'}) } }
|
provider = {
|
||||||
nonceTracker = new NonceTracker({
|
sendAsync: (_, cb) => { cb(undefined, {result: '0x0'}) },
|
||||||
blockTracker: {
|
_blockTracker: {
|
||||||
getCurrentBlock: () => '0x11b568',
|
getCurrentBlock: () => '0x11b568',
|
||||||
},
|
},
|
||||||
|
}
|
||||||
|
nonceTracker = new NonceTracker({
|
||||||
provider,
|
provider,
|
||||||
getPendingTransactions,
|
getPendingTransactions,
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user