|
|
@ -17,7 +17,7 @@ import (
|
|
|
|
// "basic" as it uses a global macaroon (by default the admin macaroon) for the
|
|
|
|
// "basic" as it uses a global macaroon (by default the admin macaroon) for the
|
|
|
|
// entire connection, and falls back to expected defaults if the arguments
|
|
|
|
// entire connection, and falls back to expected defaults if the arguments
|
|
|
|
// aren't provided.
|
|
|
|
// aren't provided.
|
|
|
|
func NewBasicClient(lndHost, tlsPath, macPath, network string) (lnrpc.LightningClient, error) {
|
|
|
|
func NewBasicClient(lndHost, tlsPath, macDir, network string) (lnrpc.LightningClient, error) {
|
|
|
|
if tlsPath == "" {
|
|
|
|
if tlsPath == "" {
|
|
|
|
tlsPath = defaultTLSCertPath
|
|
|
|
tlsPath = defaultTLSCertPath
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -33,13 +33,15 @@ func NewBasicClient(lndHost, tlsPath, macPath, network string) (lnrpc.LightningC
|
|
|
|
grpc.WithTransportCredentials(creds),
|
|
|
|
grpc.WithTransportCredentials(creds),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if macPath == "" {
|
|
|
|
if macDir == "" {
|
|
|
|
macPath = filepath.Join(
|
|
|
|
macDir = filepath.Join(
|
|
|
|
defaultLndDir, defaultDataDir, defaultChainSubDir,
|
|
|
|
defaultLndDir, defaultDataDir, defaultChainSubDir,
|
|
|
|
"bitcoin", network, defaultAdminMacaroonFilename,
|
|
|
|
"bitcoin", network,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
macPath := filepath.Join(macDir, defaultAdminMacaroonFilename)
|
|
|
|
|
|
|
|
|
|
|
|
// Load the specified macaroon file.
|
|
|
|
// Load the specified macaroon file.
|
|
|
|
macBytes, err := ioutil.ReadFile(macPath)
|
|
|
|
macBytes, err := ioutil.ReadFile(macPath)
|
|
|
|
if err == nil {
|
|
|
|
if err == nil {
|
|
|
|