rpc: support personal apis with different keyring backends (#591)

* UPDATE Unlock keyring on start

* ADD comment

* ADD validation

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
This commit is contained in:
davcrypto 2021-10-06 19:41:42 +08:00 committed by GitHub
parent 78c8ceb244
commit e79a6ed6b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,6 +12,7 @@ import (
"time" "time"
"github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -101,6 +102,17 @@ which accepts a path for the resulting pprof file.
return startStandAlone(serverCtx, appCreator) return startStandAlone(serverCtx, appCreator)
} }
serverCtx.Logger.Info("Unlocking keyring")
// fire unlock precess for keyring
keyringBackend, _ := cmd.Flags().GetString(flags.FlagKeyringBackend)
if keyringBackend == keyring.BackendFile {
_, err = clientCtx.Keyring.List()
if err != nil {
return err
}
}
serverCtx.Logger.Info("starting ABCI with Tendermint") serverCtx.Logger.Info("starting ABCI with Tendermint")
// amino is needed here for backwards compatibility of REST routes // amino is needed here for backwards compatibility of REST routes