diff --git a/lix/libstore/local-store.cc b/lix/libstore/local-store.cc index efb85ad60..82e2e8a9a 100644 --- a/lix/libstore/local-store.cc +++ b/lix/libstore/local-store.cc @@ -173,6 +173,7 @@ void migrateCASchema(SQLite& db, Path schemaPath, AutoCloseFD& lockFd) LocalStore::LocalStore(LocalStoreConfig config) : Store(config) , config_(std::move(config)) + , publicKeys(getDefaultPublicKeys()) , dbDir(config_.stateDir + "/db") , linksDir(config_.realStoreDir + "/.links") , reservedSpacePath(dbDir + "/reserved") @@ -1181,22 +1182,14 @@ void LocalStore::invalidatePath(State & state, const StorePath & path) } } -const PublicKeys & LocalStore::getPublicKeys() -{ - auto state(_state.lock()); - if (!state->publicKeys) - state->publicKeys = std::make_unique(getDefaultPublicKeys()); - return *state->publicKeys; -} - bool LocalStore::pathInfoIsUntrusted(const ValidPathInfo & info) { - return config_.requireSigs && !info.checkSignatures(*this, getPublicKeys()); + return config_.requireSigs && !info.checkSignatures(*this, publicKeys); } bool LocalStore::realisationIsUntrusted(const Realisation & realisation) { - return config_.requireSigs && !realisation.checkSignatures(getPublicKeys()); + return config_.requireSigs && !realisation.checkSignatures(publicKeys); } void LocalStore::addToStore(const ValidPathInfo & info, Source & source, diff --git a/lix/libstore/local-store.hh b/lix/libstore/local-store.hh index 0b8df601c..13b1f8b06 100644 --- a/lix/libstore/local-store.hh +++ b/lix/libstore/local-store.hh @@ -80,6 +80,8 @@ private: */ AutoCloseFD globalLock; + const PublicKeys publicKeys; + struct State { /** @@ -110,8 +112,6 @@ private: * point in starting a new GC. */ uint64_t availAfterGC = std::numeric_limits::max(); - - std::unique_ptr publicKeys; }; Sync _state; @@ -129,10 +129,6 @@ public: LocalStoreConfig & config() override { return config_; } const LocalStoreConfig & config() const override { return config_; } -private: - - const PublicKeys & getPublicKeys(); - protected: /**