Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resubmit fix #6888

Merged
merged 1 commit into from
Jul 19, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions app/scripts/controllers/transactions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class TransactionController extends EventEmitter {
this.blockTracker = opts.blockTracker
this.signEthTx = opts.signTransaction
this.getGasPrice = opts.getGasPrice
this.inProcessOfSigning = new Set()

this.memStore = new ObservableStore({})
this.query = new EthQuery(this.provider)
Expand Down Expand Up @@ -354,6 +355,15 @@ class TransactionController extends EventEmitter {
@param txId {number} - the tx's Id
*/
async approveTransaction (txId) {
// TODO: Move this safety out of this function.
// Since this transaction is async,
// we need to keep track of what is currently being signed,
// So that we do not increment nonce + resubmit something
// that is already being incrmented & signed.
if (this.inProcessOfSigning.has(txId)) {
return
}
this.inProcessOfSigning.add(txId)
let nonceLock
try {
// approve
Expand Down Expand Up @@ -387,6 +397,8 @@ class TransactionController extends EventEmitter {
if (nonceLock) nonceLock.releaseLock()
// continue with error chain
throw err
} finally {
this.inProcessOfSigning.delete(txId)
}
}
/**
Expand Down