rpc: fix deadlock (#614)

This commit is contained in:
Federico Kunze
2020-11-24 16:15:42 +01:00
committed by GitHub
parent ef4193b4d4
commit 3072376371
2 changed files with 5 additions and 2 deletions
+1 -2
View File
@@ -196,6 +196,7 @@ func (api *PublicEthereumAPI) GasPrice() *hexutil.Big {
func (api *PublicEthereumAPI) Accounts() ([]common.Address, error) {
api.logger.Debug("eth_accounts")
api.keyringLock.Lock()
defer api.keyringLock.Unlock()
addresses := make([]common.Address, 0) // return [] instead of nil if empty
@@ -204,8 +205,6 @@ func (api *PublicEthereumAPI) Accounts() ([]common.Address, error) {
return addresses, err
}
api.keyringLock.Unlock()
for _, info := range infos {
addressBytes := info.GetPubKey().Address().Bytes()
addresses = append(addresses, common.BytesToAddress(addressBytes))