diff --git a/rpc/legacyrpc/methods.go b/rpc/legacyrpc/methods.go index 3f587f8..a187dab 100644 --- a/rpc/legacyrpc/methods.go +++ b/rpc/legacyrpc/methods.go @@ -715,16 +715,22 @@ func getAccount(icmd interface{}, w *wallet.Wallet) (interface{}, error) { func getAccountAddress(icmd interface{}, w *wallet.Wallet) (interface{}, error) { cmd := icmd.(*btcjson.GetAccountAddressCmd) - account, err := w.AccountNumber(waddrmgr.KeyScopeBIP0044, cmd.Account) - if err != nil { - return nil, err - } - addr, err := w.CurrentAddress(account, waddrmgr.KeyScopeBIP0044) + account, err := w.AccountNumber(*cmd.Account) if err != nil { return nil, err } - return addr.EncodeAddress(), err + scope, err := lookupKeyScope(cmd.AddressType) + if err != nil { + return nil, err + } + + addr, err := w.CurrentAddress(account, *scope) + if err != nil { + return nil, err + } + + return addr.EncodeAddress(), nil } // getUnconfirmedBalance handles a getunconfirmedbalance extension request