accounts/usbwallet: if a confirmation is pending, skip refresh

This commit is contained in:
Péter Szilágyi
2017-03-23 17:04:39 +02:00
parent 26da6daaa9
commit 8ff7e55ab5
2 changed files with 16 additions and 3 deletions

View File

@ -579,9 +579,15 @@ func (w *ledgerWallet) SignTx(account accounts.Account, tx *types.Transaction, c
// Ensure the device isn't screwed with while user confirmation is pending
// TODO(karalabe): remove if hotplug lands on Windows
w.hub.commsLock.RLock()
defer w.hub.commsLock.RUnlock()
w.hub.commsLock.Lock()
w.hub.commsPend++
w.hub.commsLock.Unlock()
defer func() {
w.hub.commsLock.Lock()
w.hub.commsPend--
w.hub.commsLock.Unlock()
}()
return w.ledgerSign(path, account.Address, tx, chainID)
}