From 3a420d2e15482cb2311970cc9bc2fb499feaade4 Mon Sep 17 00:00:00 2001 From: Andrei Ivasko Date: Tue, 4 May 2021 11:30:10 -0400 Subject: [PATCH] pass *codec.AminoCodec as function argument in keyring.New --- crypto/keyring/keyring.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/crypto/keyring/keyring.go b/crypto/keyring/keyring.go index 28735bdd7fb8..00859e1ed081 100644 --- a/crypto/keyring/keyring.go +++ b/crypto/keyring/keyring.go @@ -165,7 +165,7 @@ type Options struct { // NewInMemory creates a transient keyring useful for testing // purposes and on-the-fly key generation. // Keybase options can be applied when generating this new Keybase. -func NewInMemory(cdc codec.AminoCodec, opts ...Option) Keyring { +func NewInMemory(cdc *codec.AminoCodec, opts ...Option) Keyring { return newKeystore(keyring.NewArrayKeyring(nil), cdc, opts...) } @@ -173,13 +173,12 @@ func NewInMemory(cdc codec.AminoCodec, opts ...Option) Keyring { // Keyring ptions can be applied when generating the new instance. // Available backends are "os", "file", "kwallet", "memory", "pass", "test". func New( - appName, backend, rootDir string, userInput io.Reader, opts ...Option, + appName, backend, rootDir string, userInput io.Reader, cdc *codec.AminoCodec, opts ...Option, ) (Keyring, error) { var ( db keyring.Keyring err error ) - cdc := codec.NewAminoCodec(codec.NewLegacyAmino()) //? switch backend { case BackendMemory: @@ -207,11 +206,11 @@ func New( type keystore struct { db keyring.Keyring - cdc codec.Marshaler + cdc *codec.AminoCodec options Options } -func newKeystore(kr keyring.Keyring, cdc codec.Marshaler, opts ...Option) keystore { +func newKeystore(kr keyring.Keyring, cdc *codec.AminoCodec, opts ...Option) keystore { // Default options for keybase options := Options{ SupportedAlgos: SigningAlgoList{hd.Secp256k1},