mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-06-22 14:51:45 +02:00
config_builder: specify root key during wallet init
This sets the macaroon root key during wallet initialization when one is provided in the init wallet params.
This commit is contained in:
parent
4b14226e81
commit
f1ed9754c2
@ -426,6 +426,17 @@ func (d *DefaultWalletImpl) BuildWalletConfig(ctx context.Context,
|
|||||||
return nil, nil, nil, err
|
return nil, nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If we have a macaroon root key from the init wallet params,
|
||||||
|
// set the root key before baking any macaroons.
|
||||||
|
if len(walletInitParams.MacRootKey) > 0 {
|
||||||
|
err := macaroonService.SetRootKey(
|
||||||
|
walletInitParams.MacRootKey,
|
||||||
|
)
|
||||||
|
if err != nil {
|
||||||
|
return nil, nil, nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Send an admin macaroon to all our listeners that requested
|
// Send an admin macaroon to all our listeners that requested
|
||||||
// one by setting a non-nil macaroon channel.
|
// one by setting a non-nil macaroon channel.
|
||||||
adminMacBytes, err := bakeMacaroon(
|
adminMacBytes, err := bakeMacaroon(
|
||||||
@ -1065,6 +1076,7 @@ func waitForWalletPassword(cfg *Config,
|
|||||||
UnloadWallet: loader.UnloadWallet,
|
UnloadWallet: loader.UnloadWallet,
|
||||||
StatelessInit: initMsg.StatelessInit,
|
StatelessInit: initMsg.StatelessInit,
|
||||||
MacResponseChan: pwService.MacResponseChan,
|
MacResponseChan: pwService.MacResponseChan,
|
||||||
|
MacRootKey: initMsg.MacRootKey,
|
||||||
}, nil
|
}, nil
|
||||||
|
|
||||||
// The wallet has already been created in the past, and is simply being
|
// The wallet has already been created in the past, and is simply being
|
||||||
|
Loading…
x
Reference in New Issue
Block a user