diff --git a/src/gxs/rsgenexchange.cc b/src/gxs/rsgenexchange.cc index adece60aab..c89d480fca 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 d8287a078b..9a1f0edbd3 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,11 @@ bool p3IdService::updateIdentity( const RsGxsId& id, const std::string& name, co else group.mMeta.mGroupFlags |= GXS_SERV::FLAG_PRIVACY_PUBLIC; + + 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 +1145,6 @@ bool p3IdService::updateIdentity( const RsGxsId& id, const std::string& name, co goto LabelUpdateIdentityCleanup; } } - mKeyCache.erase(id); if(!updateGroup(token, group)) { @@ -2108,25 +2112,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; }