diff --git a/ts/session/apis/snode_api/SnodeRequestTypes.ts b/ts/session/apis/snode_api/SnodeRequestTypes.ts index 8d1d2fd75..af76dfd88 100644 --- a/ts/session/apis/snode_api/SnodeRequestTypes.ts +++ b/ts/session/apis/snode_api/SnodeRequestTypes.ts @@ -1296,9 +1296,6 @@ type StoreOnNodeParams = StoreOnNodeNormalParams | StoreOnNodeSubAccountParams; export type MethodBatchType = 'batch' | 'sequence'; -// Until the next storage server release is released, we need to have at least 2 hashes in the list for the `get_expiries` AND for the `update_expiries` -export const fakeHash = '///////////////////////////////////////////'; - export type RawSnodeSubRequests = | RetrieveLegacyClosedGroupSubRequest | RetrieveUserSubRequest diff --git a/ts/session/apis/snode_api/expireRequest.ts b/ts/session/apis/snode_api/expireRequest.ts index da80e4aa0..3f13d5183 100644 --- a/ts/session/apis/snode_api/expireRequest.ts +++ b/ts/session/apis/snode_api/expireRequest.ts @@ -6,11 +6,7 @@ import { getSodiumRenderer } from '../../crypto'; import { StringUtils, UserUtils } from '../../utils'; import { fromBase64ToArray, fromHexToArray } from '../../utils/String'; import { SeedNodeAPI } from '../seed_node_api'; -import { - MAX_SUBREQUESTS_COUNT, - UpdateExpiryOnNodeUserSubRequest, - fakeHash, -} from './SnodeRequestTypes'; +import { MAX_SUBREQUESTS_COUNT, UpdateExpiryOnNodeUserSubRequest } from './SnodeRequestTypes'; import { BatchRequests } from './batchRequest'; import { SnodePool } from './snodePool'; import { @@ -224,7 +220,7 @@ async function updateExpiryOnNodesNoRetries( const hashesRequestedButNotInResults = difference( flatten(expireRequests.map(m => m.messageHashes)), - [...flatten(changesValid.map(c => c.messageHashes)), fakeHash] + [...flatten(changesValid.map(c => c.messageHashes))] ); if (!isEmpty(hashesRequestedButNotInResults)) { const now = Date.now(); @@ -347,13 +343,6 @@ function groupMsgByExpiry(expiringDetails: ExpiringDetails) { groupedBySameExpiry[expiryStr].push(messageHash); } - Object.keys(groupedBySameExpiry).forEach(k => { - if (groupedBySameExpiry[k].length === 1) { - // We need to have at least 2 hashes until the next storage server release - groupedBySameExpiry[k].push(fakeHash); - } - }); - return groupedBySameExpiry; } diff --git a/ts/session/apis/snode_api/getExpiriesRequest.ts b/ts/session/apis/snode_api/getExpiriesRequest.ts index ba4650af9..a8e5a3e28 100644 --- a/ts/session/apis/snode_api/getExpiriesRequest.ts +++ b/ts/session/apis/snode_api/getExpiriesRequest.ts @@ -5,7 +5,7 @@ import pRetry from 'p-retry'; import { Snode } from '../../../data/types'; import { UserUtils } from '../../utils'; import { SeedNodeAPI } from '../seed_node_api'; -import { GetExpiriesFromNodeSubRequest, fakeHash } from './SnodeRequestTypes'; +import { GetExpiriesFromNodeSubRequest } from './SnodeRequestTypes'; import { BatchRequests } from './batchRequest'; import { SnodePool } from './snodePool'; import { GetExpiriesResultsContent, WithMessagesHashes } from './types'; @@ -104,14 +104,9 @@ async function getExpiriesFromNodesNoRetries( * The returned TTLs should be assigned to the given disappearing messages. * @param messageHashes the hashes of the messages we want the current expiries for * @param timestamp the time (ms) the request was initiated, must be within ±60s of the current time so using the server time is recommended. - * @returns an arrray of the expiry timestamps (TTL) for the given messages + * @returns an array of the expiry timestamps (TTL) for the given messages */ export async function getExpiriesFromSnode({ messagesHashes }: WithMessagesHashes) { - // FIXME There is a bug in the snode code that requires at least 2 messages to be requested. Will be fixed in next storage server release - if (messagesHashes.length === 1) { - messagesHashes.push(fakeHash); - } - const ourPubKey = UserUtils.getOurPubKeyStrFromCache(); if (!ourPubKey) { window.log.error('[getExpiriesFromSnode] No pubkey found', messagesHashes); diff --git a/ts/test/session/unit/disappearing_messages/GetExpiriesRequest_test.ts b/ts/test/session/unit/disappearing_messages/GetExpiriesRequest_test.ts index f4865b164..3411f66ed 100644 --- a/ts/test/session/unit/disappearing_messages/GetExpiriesRequest_test.ts +++ b/ts/test/session/unit/disappearing_messages/GetExpiriesRequest_test.ts @@ -2,10 +2,7 @@ import chai, { expect } from 'chai'; import chaiAsPromised from 'chai-as-promised'; import { PubkeyType } from 'libsession_util_nodejs'; import Sinon from 'sinon'; -import { - GetExpiriesFromNodeSubRequest, - fakeHash, -} from '../../../../session/apis/snode_api/SnodeRequestTypes'; +import { GetExpiriesFromNodeSubRequest } from '../../../../session/apis/snode_api/SnodeRequestTypes'; import { GetExpiriesRequestResponseResults, processGetExpiriesRequestResponse, @@ -110,8 +107,7 @@ describe('GetExpiriesRequest', () => { const props = { targetNode: generateFakeSnode(), expiries: { 'FLTUh/C/6E+sWRgNtrqWPXhQqKlIrpHVKJJtZsBMWKw': 1696983251624 }, - // FIXME There is a bug in the snode code that requires at least 2 messages to be requested. Will be fixed in next storage server release - messageHashes: ['FLTUh/C/6E+sWRgNtrqWPXhQqKlIrpHVKJJtZsBMWKw', fakeHash], + messageHashes: ['FLTUh/C/6E+sWRgNtrqWPXhQqKlIrpHVKJJtZsBMWKw'], }; it('returns valid results if the response is valid', async () => {