Revert "bump SDK commit (#324)" (#328)

This reverts commit 5614adc933.
This commit is contained in:
Federico Kunze
2020-06-08 20:33:48 +02:00
committed by GitHub
parent 988ee53a59
commit 7b164a5aa4
11 changed files with 53 additions and 323 deletions
+5 -12
View File
@@ -10,7 +10,6 @@ import (
"github.com/cosmos/cosmos-sdk/client/input"
"github.com/cosmos/cosmos-sdk/client/lcd"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/crypto"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
sdk "github.com/cosmos/cosmos-sdk/types"
authrest "github.com/cosmos/cosmos-sdk/x/auth/client/rest"
@@ -106,26 +105,20 @@ func registerRoutes(rs *lcd.RestServer) {
}
func unlockKeyFromNameAndPassphrase(accountName, passphrase string) (emintKey emintcrypto.PrivKeySecp256k1, err error) {
keystore, err := keyring.New(
keybase, err := keyring.NewKeyring(
sdk.KeyringServiceName(),
viper.GetString(flags.FlagKeyringBackend),
viper.GetString(flags.FlagHome),
os.Stdin,
)
if err != nil {
return nil, err
return
}
// With keyring key store, password is not required as it is pulled from the OS prompt
// Exports private key from keyring using password
armored, err := keystore.ExportPrivKeyArmor(accountName, passphrase)
// With keyring keybase, password is not required as it is pulled from the OS prompt
privKey, err := keybase.ExportPrivateKeyObject(accountName, passphrase)
if err != nil {
return nil, err
}
privKey, _, err := crypto.UnarmorDecryptPrivKey(armored, passphrase)
if err != nil {
return nil, err
return
}
var ok bool
+9 -9
View File
@@ -45,11 +45,11 @@ import (
// PublicEthAPI is the eth_ prefixed set of APIs in the Web3 JSON-RPC spec.
type PublicEthAPI struct {
cliCtx context.CLIContext
backend Backend
key emintcrypto.PrivKeySecp256k1
nonceLock *AddrLocker
keystoreLock sync.Mutex
cliCtx context.CLIContext
backend Backend
key emintcrypto.PrivKeySecp256k1
nonceLock *AddrLocker
keybaseLock sync.Mutex
}
// NewPublicEthAPI creates an instance of the public ETH Web3 API.
@@ -123,11 +123,11 @@ func (e *PublicEthAPI) GasPrice() *hexutil.Big {
// Accounts returns the list of accounts available to this node.
func (e *PublicEthAPI) Accounts() ([]common.Address, error) {
e.keystoreLock.Lock()
e.keybaseLock.Lock()
addresses := make([]common.Address, 0) // return [] instead of nil if empty
keystore, err := keyring.New(
keybase, err := keyring.NewKeyring(
sdk.KeyringServiceName(),
viper.GetString(flags.FlagKeyringBackend),
viper.GetString(flags.FlagHome),
@@ -137,12 +137,12 @@ func (e *PublicEthAPI) Accounts() ([]common.Address, error) {
return addresses, err
}
infos, err := keystore.List()
infos, err := keybase.List()
if err != nil {
return addresses, err
}
e.keystoreLock.Unlock()
e.keybaseLock.Unlock()
for _, info := range infos {
addressBytes := info.GetPubKey().Address().Bytes()