Skip to content

Commit 313262d

Browse files
committed
lit: change the signature of bakeSuperMac to take an LND client
So that we have control over which LND client the rpcProxy should use for various calls.
1 parent 744dd3a commit 313262d

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

rpc_proxy.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,8 @@ type rpcProxy struct {
189189
}
190190

191191
// bakeSuperMac can be used to bake a new super macaroon.
192-
type bakeSuperMac func(ctx context.Context, rootKeyID uint32) (string, error)
192+
type bakeSuperMac func(ctx context.Context, lndClient lnrpc.LightningClient,
193+
rootKeyID uint32) (string, error)
193194

194195
// Start creates initial connection to lnd.
195196
func (p *rpcProxy) Start(lndConn *grpc.ClientConn,
@@ -259,7 +260,7 @@ func (p *rpcProxy) BakeSuperMacaroon(ctx context.Context,
259260
return nil, ErrWaitingToStart
260261
}
261262

262-
superMac, err := p.bakeSuperMac(ctx, req.RootKeyIdSuffix)
263+
superMac, err := p.bakeSuperMac(ctx, p.basicClient, req.RootKeyIdSuffix)
263264
if err != nil {
264265
return nil, err
265266
}

terminal.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -579,16 +579,17 @@ func (g *LightningTerminal) start() error {
579579

580580
// bakeSuperMac is a closure that can be used to bake a new super
581581
// macaroon that contains all active permissions.
582-
bakeSuperMac := func(ctx context.Context, rootKeyIDSuffix uint32) (
583-
string, error) {
582+
bakeSuperMac := func(ctx context.Context,
583+
lndClient lnrpc.LightningClient,
584+
rootKeyIDSuffix uint32) (string, error) {
584585

585586
var suffixBytes [4]byte
586587
binary.BigEndian.PutUint32(suffixBytes[:], rootKeyIDSuffix)
587588

588589
rootKeyID := session.NewSuperMacaroonRootKeyID(suffixBytes)
589590

590591
return BakeSuperMacaroon(
591-
ctx, g.basicClient, rootKeyID,
592+
ctx, lndClient, rootKeyID,
592593
g.permsMgr.ActivePermissions(false), nil,
593594
)
594595
}

0 commit comments

Comments
 (0)