Skip to content
This repository has been archived by the owner on Nov 30, 2021. It is now read-only.

rpc: fix deadlock #614

Merged
merged 2 commits into from
Nov 24, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (evm) [#603](https://github.com/cosmos/ethermint/pull/603) Add state transition params that enable or disable the EVM `Call` and `Create` operations.
* (deps) [\#602](https://github.com/cosmos/ethermint/pull/602) Bump tendermint version to [v0.33.9](https://github.com/tendermint/tendermint/releases/tag/v0.33.9)

### Bug Fixes

* (rpc) [\#613](https://github.com/cosmos/ethermint/issues/613) Fix potential deadlock caused if the keyring `List` returned an error.

## [v0.3.0] - 2020-11-16

### API Breaking
Expand Down
3 changes: 1 addition & 2 deletions rpc/namespaces/eth/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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))
Expand Down