mirror of
https://github.com/LBRYFoundation/lbcwallet.git
synced 2025-08-23 17:47:29 +00:00
multi-account: update getrawchangeaddress
This commit is contained in:
parent
c0b263ece7
commit
43bbf0a089
1 changed files with 13 additions and 6 deletions
|
@ -899,17 +899,24 @@ func getNewAddress(icmd interface{}, w *wallet.Wallet) (interface{}, error) {
|
||||||
// Note: bitcoind allows specifying the account as an optional parameter,
|
// Note: bitcoind allows specifying the account as an optional parameter,
|
||||||
// but ignores the parameter.
|
// but ignores the parameter.
|
||||||
func getRawChangeAddress(icmd interface{}, w *wallet.Wallet) (interface{}, error) {
|
func getRawChangeAddress(icmd interface{}, w *wallet.Wallet) (interface{}, error) {
|
||||||
|
|
||||||
cmd := icmd.(*btcjson.GetRawChangeAddressCmd)
|
cmd := icmd.(*btcjson.GetRawChangeAddressCmd)
|
||||||
|
|
||||||
acctName := defaultAccountName
|
account, err := w.AccountNumber(*cmd.Account)
|
||||||
if cmd.Account != nil {
|
|
||||||
acctName = *cmd.Account
|
|
||||||
}
|
|
||||||
account, err := w.AccountNumber(waddrmgr.KeyScopeBIP0044, acctName)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
addr, err := w.NewChangeAddress(account, waddrmgr.KeyScopeBIP0044)
|
|
||||||
|
// Use specified scope, if provided.
|
||||||
|
scope, err := lookupKeyScope(cmd.AddressType)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if scope == nil {
|
||||||
|
scope = &waddrmgr.DefaultKeyScope
|
||||||
|
}
|
||||||
|
|
||||||
|
addr, err := w.NewChangeAddress(account, *scope)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue