good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
E
Erigon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
a
Erigon
Commits
8ff7e55a
Unverified
Commit
8ff7e55a
authored
8 years ago
by
Péter Szilágyi
Browse files
Options
Downloads
Patches
Plain Diff
accounts/usbwallet: if a confirmation is pending, skip refresh
parent
26da6daa
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
accounts/usbwallet/ledger_hub.go
+8
-1
8 additions, 1 deletion
accounts/usbwallet/ledger_hub.go
accounts/usbwallet/ledger_wallet.go
+8
-2
8 additions, 2 deletions
accounts/usbwallet/ledger_wallet.go
with
16 additions
and
3 deletions
accounts/usbwallet/ledger_hub.go
+
8
−
1
View file @
8ff7e55a
...
...
@@ -58,7 +58,10 @@ type LedgerHub struct {
quit
chan
chan
error
stateLock
sync
.
RWMutex
// Protects the internals of the hub from racey access
commsLock
sync
.
RWMutex
// Allows wallets to lock enumeration (TODO(karalabe): remove if hotplug lands on Windows)
// TODO(karalabe): remove if hotplug lands on Windows
commsPend
int
// Number of operations blocking enumeration
commsLock
sync
.
Mutex
// Lock protecting the pending counter and enumeration
}
// NewLedgerHub creates a new hardware wallet manager for Ledger devices.
...
...
@@ -109,6 +112,10 @@ func (hub *LedgerHub) refreshWallets() {
// be to ditch enumeration in favor of hutplug events, but that don't work yet
// on Windows so if we need to hack it anyway, this is more elegant for now.
hub
.
commsLock
.
Lock
()
if
hub
.
commsPend
>
0
{
// A confirmation is pending, don't refresh
hub
.
commsLock
.
Unlock
()
return
}
}
for
_
,
info
:=
range
hid
.
Enumerate
(
0
,
0
)
{
// Can't enumerate directly, one valid ID is the 0 wildcard
for
_
,
id
:=
range
ledgerDeviceIDs
{
...
...
This diff is collapsed.
Click to expand it.
accounts/usbwallet/ledger_wallet.go
+
8
−
2
View file @
8ff7e55a
...
...
@@ -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
)
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment