OSDN Git Service
(root)
/
bytom
/
bytom-spv.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
23c2ab0
)
fix bug for "duplicated alias"
author
Blockmeta-区块元
<blockmeta@8btc.com>
Thu, 19 Apr 2018 11:53:24 +0000
(19:53 +0800)
committer
Blockmeta-区块元
<blockmeta@8btc.com>
Thu, 19 Apr 2018 11:53:24 +0000
(19:53 +0800)
fix bug “duplicated alias problem” while creating keys concurrently
blockchain/pseudohsm/pseudohsm.go
patch
|
blob
|
history
diff --git
a/blockchain/pseudohsm/pseudohsm.go
b/blockchain/pseudohsm/pseudohsm.go
index
fe18e1a
..
48ff9b9
100644
(file)
--- a/
blockchain/pseudohsm/pseudohsm.go
+++ b/
blockchain/pseudohsm/pseudohsm.go
@@
-49,14
+49,14
@@
func New(keypath string) (*HSM, error) {
// XCreate produces a new random xprv and stores it in the db.
func (h *HSM) XCreate(alias string, auth string) (*XPub, error) {
+ h.cacheMu.Lock()
+ defer h.cacheMu.Unlock()
+
normalizedAlias := strings.ToLower(strings.TrimSpace(alias))
if ok := h.cache.hasAlias(normalizedAlias); ok {
return nil, ErrDuplicateKeyAlias
}
- h.cacheMu.Lock()
- defer h.cacheMu.Unlock()
-
xpub, _, err := h.createChainKDKey(auth, normalizedAlias, false)
if err != nil {
return nil, err