From 5d5c8f42c138deecf379c7f466d8ec0cad04d518 Mon Sep 17 00:00:00 2001 From: jolavillette Date: Sun, 25 Jan 2026 14:27:13 +0100 Subject: [PATCH 1/2] Subject: Fix GXS Identity propagation and local cache invalidation --- src/services/p3idservice.cc | 32 +++++++++----------------------- 1 file changed, 9 insertions(+), 23 deletions(-) diff --git a/src/services/p3idservice.cc b/src/services/p3idservice.cc index d8287a078..8239dc7ae 100644 --- a/src/services/p3idservice.cc +++ b/src/services/p3idservice.cc @@ -663,10 +663,15 @@ void p3IdService::notifyChanges(std::vector &changes) mRejectedIdentities.insert(RsGxsId(groupChange->mGroupId)); break; - case RsGxsNotify::TYPE_GROUP_DELETED: case RsGxsNotify::TYPE_UPDATED: case RsGxsNotify::TYPE_PUBLISHED: { + // Invalidate cache to force reload of new data (e.g. avatar) + { + RsStackMutex stack(mIdMtx); + mKeyCache.erase(RsGxsId(gid)); + } + auto ev = std::make_shared(); ev->mIdentityId = gid; @@ -1126,11 +1131,12 @@ bool p3IdService::updateIdentity( const RsGxsId& id, const std::string& name, co else group.mMeta.mGroupFlags |= GXS_SERV::FLAG_PRIVACY_PUBLIC; + // Fixed: Explicitly update timestamp to ensure network propagation + group.mMeta.mPublishTs = time(NULL); + uint32_t token; bool ret = true; - // Cache pgp passphrase to allow a proper re-signing of the group data - if(!pseudonimous && !pgpPassword.empty()) { if(!RsLoginHandler::cachePgpPassphrase(pgpPassword)) @@ -1140,7 +1146,6 @@ bool p3IdService::updateIdentity( const RsGxsId& id, const std::string& name, co goto LabelUpdateIdentityCleanup; } } - mKeyCache.erase(id); if(!updateGroup(token, group)) { @@ -2108,25 +2113,6 @@ bool p3IdService::updateGroup(uint32_t& token, RsGxsIdGroup &group) RsGenExchange::updateGroup(token, item); - // if its in the cache - clear it. - { - RsStackMutex stack(mIdMtx); /********** STACK LOCKED MTX ******/ - if (mKeyCache.erase(id)) - { -#ifdef DEBUG_IDS - std::cerr << "p3IdService::updateGroup() Removed from PublicKeyCache"; - std::cerr << std::endl; -#endif - } - else - { -#ifdef DEBUG_IDS - std::cerr << "p3IdService::updateGroup() Not in PublicKeyCache"; - std::cerr << std::endl; -#endif - } - } - return true; } From 482ed05dd92faf1c8f626be77ab8870f83ab524f Mon Sep 17 00:00:00 2001 From: jolavillette Date: Tue, 27 Jan 2026 07:23:51 +0100 Subject: [PATCH 2/2] GXS: update mPublishTs correctly in RsGenExchange and prevent unnecessary cache invalidation --- src/gxs/rsgenexchange.cc | 6 +++++- src/services/p3idservice.cc | 3 +-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/gxs/rsgenexchange.cc b/src/gxs/rsgenexchange.cc index adece60aa..c89d480fc 100644 --- a/src/gxs/rsgenexchange.cc +++ b/src/gxs/rsgenexchange.cc @@ -2801,6 +2801,10 @@ void RsGenExchange::publishGrps() if(ret == SERVICE_CREATE_SUCCESS) { + // MODIFICATION: Update timestamp BEFORE serialization so the payload matches the meta. + // This fixes propagation issues where peers rejected the update due to stale timestamp in bin data. + grpItem->meta.mPublishTs = time(NULL); + uint32_t size = mSerialiser->size(grpItem); char *gData = new char[size]; serialOk = mSerialiser->serialise(grpItem, gData, &size); @@ -2816,7 +2820,7 @@ void RsGenExchange::publishGrps() if(serialOk && servCreateOk) { grp->metaData = new RsGxsGrpMetaData(); - grpItem->meta.mPublishTs = time(NULL); + // grpItem->meta.mPublishTs = time(NULL); // Moved up *(grp->metaData) = grpItem->meta; // TODO: change when publish key optimisation added (public groups don't have publish key diff --git a/src/services/p3idservice.cc b/src/services/p3idservice.cc index 8239dc7ae..9a1f0edbd 100644 --- a/src/services/p3idservice.cc +++ b/src/services/p3idservice.cc @@ -1131,8 +1131,7 @@ bool p3IdService::updateIdentity( const RsGxsId& id, const std::string& name, co else group.mMeta.mGroupFlags |= GXS_SERV::FLAG_PRIVACY_PUBLIC; - // Fixed: Explicitly update timestamp to ensure network propagation - group.mMeta.mPublishTs = time(NULL); + uint32_t token; bool ret = true;