Commit 0ac6a26f authored by David Theodore's avatar David Theodore Committed by GitHub

fixed two mutex usage bugs (#9004)

parent 20d98629
......@@ -179,8 +179,8 @@ func (db *MemoryStateDB) SetCode(addr common.Address, code []byte) {
}
func (db *MemoryStateDB) GetCodeSize(addr common.Address) int {
db.rw.Lock()
defer db.rw.Unlock()
db.rw.RLock()
defer db.rw.RUnlock()
account, ok := db.genesis.Alloc[addr]
if !ok {
......@@ -232,6 +232,9 @@ func (db *MemoryStateDB) SetState(addr common.Address, key, value common.Hash) {
}
func (db *MemoryStateDB) DeleteState(addr common.Address, key common.Hash) {
db.rw.Lock()
defer db.rw.Unlock()
account, ok := db.genesis.Alloc[addr]
if !ok {
panic(fmt.Sprintf("%s not in state", addr))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment