macaroons: remember stateless init

To make sure no macaroons are created anywhere if the stateless
initialization was requested, we keep the requested initialization mode
in the memory of the macaroon service.
This commit is contained in:
Oliver Gugger committed 2020-11-07 11:24:33 +01:00
1 parent ae71d60715
commit 294cb4a966
3 files changed
+13 -6

No files matched your search

+4 -4
View File
@@ -67,7 +67,7 @@ func TestNewService(t *testing.T) {
// Second, create the new service instance, unlock it and pass in a
// checker that we expect it to add to the bakery.
service, err := macaroons.NewService(
tempDir, "lnd", macaroons.IPLockChecker,
tempDir, "lnd", false, macaroons.IPLockChecker,
)
if err != nil {
t.Fatalf("Error creating new service: %v", err)
@@ -118,7 +118,7 @@ func TestValidateMacaroon(t *testing.T) {
tempDir := setupTestRootKeyStorage(t)
defer os.RemoveAll(tempDir)
service, err := macaroons.NewService(
tempDir, "lnd", macaroons.IPLockChecker,
tempDir, "lnd", false, macaroons.IPLockChecker,
)
if err != nil {
t.Fatalf("Error creating new service: %v", err)
@@ -178,7 +178,7 @@ func TestListMacaroonIDs(t *testing.T) {
// Second, create the new service instance, unlock it and pass in a
// checker that we expect it to add to the bakery.
service, err := macaroons.NewService(
tempDir, "lnd", macaroons.IPLockChecker,
tempDir, "lnd", false, macaroons.IPLockChecker,
)
require.NoError(t, err, "Error creating new service")
defer service.Close()
@@ -210,7 +210,7 @@ func TestDeleteMacaroonID(t *testing.T) {
// Second, create the new service instance, unlock it and pass in a
// checker that we expect it to add to the bakery.
service, err := macaroons.NewService(
tempDir, "lnd", macaroons.IPLockChecker,
tempDir, "lnd", false, macaroons.IPLockChecker,
)
require.NoError(t, err, "Error creating new service")
defer service.Close()