Skip to content

Commit

Permalink
rollback to use normal mutex in nodeDB (#432)
Browse files Browse the repository at this point in the history
  • Loading branch information
yun-yeo committed Sep 1, 2021
1 parent 96b7f42 commit 89f6b77
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions nodedb.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ var (
)

type nodeDB struct {
mtx sync.RWMutex // Read/write lock.
mtx sync.Mutex // Read/write lock.
db dbm.DB // Persistent node storage.
batch dbm.Batch // Batched writing buffer.
opts Options // Options to customize for pruning/writing
Expand Down Expand Up @@ -68,8 +68,8 @@ func newNodeDB(db dbm.DB, cacheSize int, opts *Options) *nodeDB {
// GetNode gets a node from memory or disk. If it is an inner node, it does not
// load its children.
func (ndb *nodeDB) GetNode(hash []byte) *Node {
ndb.mtx.RLock()
defer ndb.mtx.RUnlock()
ndb.mtx.Lock()
defer ndb.mtx.Unlock()

if len(hash) == 0 {
panic("nodeDB.GetNode() requires hash")
Expand Down

0 comments on commit 89f6b77

Please sign in to comment.