Skip to content

Commit

Permalink
chore: remove params and add check if wallet name is set to create fu…
Browse files Browse the repository at this point in the history
…ll host naming
  • Loading branch information
RafilxTenfen committed Aug 16, 2024
1 parent 02ca753 commit c6d6b37
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions walletcontroller/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func NewRpcWalletControllerFromArgs(
) (*RpcWalletController, error) {

connCfg := &rpcclient.ConnConfig{
Host: host + "/wallet/" + walletName,
Host: rpcHostName(host, walletName),
User: user,
Pass: pass,
DisableTLS: disableTls,
Expand All @@ -77,7 +77,6 @@ func NewRpcWalletControllerFromArgs(
// we use post mode as it sure it works with either bitcoind or btcwallet
// we may need to re-consider it later if we need any notifications
HTTPPostMode: true,
Params: params.Name,
}

if !connCfg.DisableTLS {
Expand All @@ -101,6 +100,13 @@ func NewRpcWalletControllerFromArgs(
}, nil
}

func rpcHostName(host, walletName string) string {
if len(walletName) > 0 {
return host + "/wallet/" + walletName
}
return host
}

func (w *RpcWalletController) UnlockWallet(timoutSec int64) error {
return w.WalletPassphrase(w.walletPassphrase, timoutSec)
}
Expand Down

0 comments on commit c6d6b37

Please sign in to comment.