From 76845975b3ecec491fc13f981d617b6cf66bab41 Mon Sep 17 00:00:00 2001 From: PJ Date: Wed, 8 May 2024 13:41:12 +0200 Subject: [PATCH] contracts: update root cache upon renewal --- host/contracts/manager.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/host/contracts/manager.go b/host/contracts/manager.go index cab7ff52..9ea8a582 100644 --- a/host/contracts/manager.go +++ b/host/contracts/manager.go @@ -229,6 +229,13 @@ func (cm *ContractManager) RenewContract(renewal SignedRevision, existing Signed return err } cm.log.Debug("contract renewed", zap.Stringer("renewalID", renewal.Revision.ParentID), zap.Stringer("existingID", existing.Revision.ParentID)) + + // update roots cache + roots, ok := cm.rootsCache.Get(existing.Revision.ParentID) + if ok { + cm.rootsCache.Add(renewal.Revision.ParentID, roots) + cm.rootsCache.Remove(existing.Revision.ParentID) + } return nil }