forked from cerc-io/laconicd-deprecated
rpc: fix deadlock (#614)
This commit is contained in:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user