Unlock transaction on RPC errors

This commit is contained in:
maciejhirsz 2017-04-10 11:22:32 +02:00
parent a45791d2c0
commit b11a84a347
1 changed files with 6 additions and 0 deletions

View File

@ -169,6 +169,12 @@ export default class LocalAccountsMiddleware extends Middleware {
this.rpcRequest('parity_nextNonce', [from]),
account.decryptPrivateKey(password)
])
.catch((err) => {
transactions.unlock(id);
// transaction got unlocked, can propagate rejection further
throw err;
})
.then(([nonce, privateKey]) => {
if (!privateKey) {
transactions.unlock(id);