mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-17 01:13:45 +00:00
ethdb: use RLock for Has
This commit is contained in:
parent
1e6dcb35ab
commit
c9b7a2a4b7
1 changed files with 2 additions and 2 deletions
|
|
@ -46,8 +46,8 @@ func (db *MemDatabase) Put(key []byte, value []byte) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (db *MemDatabase) Has(key []byte) (bool, error) {
|
func (db *MemDatabase) Has(key []byte) (bool, error) {
|
||||||
db.lock.Lock()
|
db.lock.RLock()
|
||||||
defer db.lock.Unlock()
|
defer db.lock.RUnlock()
|
||||||
|
|
||||||
_, ok := db.db[string(key)]
|
_, ok := db.db[string(key)]
|
||||||
return ok, nil
|
return ok, nil
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue