mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-02-22 14:22:37 +01:00
Merge pull request #5930 from guggero/no-seed-backup-macaroon
config_builder: always send admin macaroon
This commit is contained in:
commit
54584aabb6
3 changed files with 21 additions and 18 deletions
|
@ -422,28 +422,29 @@ func (d *DefaultWalletImpl) BuildWalletConfig(ctx context.Context,
|
|||
return nil, nil, nil, err
|
||||
}
|
||||
|
||||
// Send an admin macaroon to all our listeners that requested
|
||||
// one by setting a non-nil macaroon channel.
|
||||
adminMacBytes, err := bakeMacaroon(
|
||||
ctx, macaroonService, adminPermissions(),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
for _, lis := range grpcListeners {
|
||||
if lis.MacChan != nil {
|
||||
lis.MacChan <- adminMacBytes
|
||||
}
|
||||
}
|
||||
|
||||
// In case we actually needed to unlock the wallet, we now need
|
||||
// to create an instance of the admin macaroon and send it to
|
||||
// the unlocker so it can forward it to the user. In no seed
|
||||
// backup mode, there's nobody listening on the channel and we'd
|
||||
// block here forever.
|
||||
if !d.cfg.NoSeedBackup {
|
||||
adminMacBytes, err := bakeMacaroon(
|
||||
ctx, macaroonService, adminPermissions(),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
|
||||
// The channel is buffered by one element so writing
|
||||
// should not block here.
|
||||
walletInitParams.MacResponseChan <- adminMacBytes
|
||||
|
||||
for _, lis := range grpcListeners {
|
||||
if lis.MacChan != nil {
|
||||
lis.MacChan <- adminMacBytes
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If the user requested a stateless initialization, no macaroon
|
||||
|
|
|
@ -615,6 +615,9 @@ messages directly. There is no routing/path finding involved.
|
|||
the first one was successful](
|
||||
https://github.com/lightningnetwork/lnd/pull/5925)
|
||||
|
||||
* [Fixed an issue with external listeners and the `--noseedbackup` development
|
||||
flag](https://github.com/lightningnetwork/lnd/pull/5930).
|
||||
|
||||
## Documentation
|
||||
|
||||
The [code contribution guidelines have been updated to mention the new
|
||||
|
|
9
lnd.go
9
lnd.go
|
@ -224,10 +224,8 @@ func Main(cfg *Config, lisCfg ListenerCfg, implCfg *ImplementationCfg,
|
|||
|
||||
// If we have chosen to start with a dedicated listener for the
|
||||
// rpc server, we set it directly.
|
||||
var grpcListeners []*ListenerWithSignal
|
||||
if len(lisCfg.RPCListeners) > 0 {
|
||||
grpcListeners = append(grpcListeners, lisCfg.RPCListeners...)
|
||||
} else {
|
||||
grpcListeners := append([]*ListenerWithSignal{}, lisCfg.RPCListeners...)
|
||||
if len(grpcListeners) == 0 {
|
||||
// Otherwise we create listeners from the RPCListeners defined
|
||||
// in the config.
|
||||
for _, grpcEndpoint := range cfg.RPCListeners {
|
||||
|
@ -245,7 +243,8 @@ func Main(cfg *Config, lisCfg ListenerCfg, implCfg *ImplementationCfg,
|
|||
grpcListeners, &ListenerWithSignal{
|
||||
Listener: lis,
|
||||
Ready: make(chan struct{}),
|
||||
})
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue