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

Rename _checkIfTxWasDropped (#8378)

This commit is contained in:
Whymarrh Whitby 2020-04-22 17:03:59 -02:30 committed by GitHub
parent d0e7f4beaf
commit deacde615f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View File

@ -164,7 +164,7 @@ class PendingTransactionTracker extends EventEmitter {
try { try {
// check the network if the nonce is ahead the tx // check the network if the nonce is ahead the tx
// and the tx has not been mined into a block // and the tx has not been mined into a block
dropped = await this._checkIftxWasDropped(txMeta, transactionReceipt) dropped = await this._checkIfTxWasDropped(txMeta, transactionReceipt)
// the dropped buffer is in case we ask a node for the tx // the dropped buffer is in case we ask a node for the tx
// that is behind the node we asked for tx count // that is behind the node we asked for tx count
@ -213,7 +213,7 @@ class PendingTransactionTracker extends EventEmitter {
@returns {boolean} @returns {boolean}
*/ */
async _checkIftxWasDropped (txMeta, transactionReceipt) { async _checkIfTxWasDropped (txMeta, transactionReceipt) {
const { txParams: { nonce, from } } = txMeta const { txParams: { nonce, from } } = txMeta
const nextNonce = await this.query.getTransactionCount(from) const nextNonce = await this.query.getTransactionCount(from)
if ( if (

View File

@ -302,7 +302,7 @@ describe('PendingTransactionTracker', function () {
}) })
}) })
describe('#_checkIftxWasDropped', function () { describe('#_checkIfTxWasDropped', function () {
const txMeta = { const txMeta = {
id: 1, id: 1,
hash: '0x0593ee121b92e10d63150ad08b4b8f9c7857d1bd160195ee648fb9a0f8d00eeb', hash: '0x0593ee121b92e10d63150ad08b4b8f9c7857d1bd160195ee648fb9a0f8d00eeb',
@ -317,14 +317,14 @@ describe('PendingTransactionTracker', function () {
it('should return false when the nonce is the suggested network nonce', async function () { it('should return false when the nonce is the suggested network nonce', async function () {
providerResultStub['eth_getTransactionCount'] = '0x01' providerResultStub['eth_getTransactionCount'] = '0x01'
providerResultStub['eth_getTransactionReceipt'] = {} providerResultStub['eth_getTransactionReceipt'] = {}
const dropped = await pendingTxTracker._checkIftxWasDropped(txMeta, {}) const dropped = await pendingTxTracker._checkIfTxWasDropped(txMeta, {})
assert.ok(!dropped, 'should be false') assert.ok(!dropped, 'should be false')
}) })
it('should return true when the network nonce is higher then the txMeta nonce', async function () { it('should return true when the network nonce is higher then the txMeta nonce', async function () {
providerResultStub['eth_getTransactionCount'] = '0x02' providerResultStub['eth_getTransactionCount'] = '0x02'
providerResultStub['eth_getTransactionReceipt'] = {} providerResultStub['eth_getTransactionReceipt'] = {}
const dropped = await pendingTxTracker._checkIftxWasDropped(txMeta, {}) const dropped = await pendingTxTracker._checkIfTxWasDropped(txMeta, {})
assert.ok(dropped, 'should be true') assert.ok(dropped, 'should be true')
}) })
}) })