mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-21 06:06:20 +02:00
lnrpc+macaroon: skip subserver macaroons on stateless_init
This will prevent the subservers from writing macaroons to disk when the stateless_init flag is set to true. It accomplishes this by storing the StatelessInit value in the Macaroon Service.
This commit is contained in:
committed by
Oliver Gugger
parent
0b9b7def15
commit
5aa0d26251
@@ -103,9 +103,12 @@ func New(cfg *Config) (*Server, lnrpc.MacaroonPerms, error) {
|
||||
}
|
||||
|
||||
// Now that we know the full path of the signer macaroon, we can check
|
||||
// to see if we need to create it or not.
|
||||
// to see if we need to create it or not. If stateless_init is set
|
||||
// then we don't write the macaroons.
|
||||
macFilePath := cfg.SignerMacPath
|
||||
if cfg.MacService != nil && !lnrpc.FileExists(macFilePath) {
|
||||
if cfg.MacService != nil && !cfg.MacService.StatelessInit &&
|
||||
!lnrpc.FileExists(macFilePath) {
|
||||
|
||||
log.Infof("Making macaroons for Signer RPC Server at: %v",
|
||||
macFilePath)
|
||||
|
||||
@@ -125,7 +128,7 @@ func New(cfg *Config) (*Server, lnrpc.MacaroonPerms, error) {
|
||||
}
|
||||
err = ioutil.WriteFile(macFilePath, signerMacBytes, 0644)
|
||||
if err != nil {
|
||||
os.Remove(macFilePath)
|
||||
_ = os.Remove(macFilePath)
|
||||
return nil, nil, err
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user