mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-07 12:32:29 +02:00
rpcperms+lnd: use macaroon service from interceptor chain
We'll refactor the wallet creation and unlock process in a following commit and want to make it possible to not need a direct reference to the macaroon service in our main function. Since we store it in the interceptor chain anyway (if we're using macaroons in the first place), we might as well use the instance there directly.
This commit is contained in:
@@ -386,6 +386,15 @@ func (r *InterceptorChain) AddMacaroonService(svc *macaroons.Service) {
|
||||
r.svc = svc
|
||||
}
|
||||
|
||||
// MacaroonService returns the currently registered macaroon service. This might
|
||||
// be nil if none was registered (yet).
|
||||
func (r *InterceptorChain) MacaroonService() *macaroons.Service {
|
||||
r.RLock()
|
||||
defer r.RUnlock()
|
||||
|
||||
return r.svc
|
||||
}
|
||||
|
||||
// AddPermission adds a new macaroon rule for the given method.
|
||||
func (r *InterceptorChain) AddPermission(method string, ops []bakery.Op) error {
|
||||
r.Lock()
|
||||
|
Reference in New Issue
Block a user