querysub 0.95.0 → 0.97.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "querysub",
3
- "version": "0.95.0",
3
+ "version": "0.97.0",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
6
  "note1": "note on node-forge fork, see https://github.com/digitalbazaar/forge/issues/744 for details",
@@ -176,11 +176,6 @@ const IdentityController = SocketFunction.register(
176
176
  );
177
177
 
178
178
  const changeIdentityOnce = cache(async function changeIdentityOnce(connectionId: { nodeId: string }) {
179
- // Wait for time sync, otherwise the time in our change identity might be rejected.
180
- await measureBlock(async () => {
181
- await waitForFirstTimeSync();
182
- }, "waitForFirstTimeSync");
183
-
184
179
  let nodeId = connectionId.nodeId;
185
180
  let threadKeyCert = getThreadKeyCert();
186
181
  let issuer = getIdentityCA();
@@ -113,10 +113,17 @@ export function isOwnNodeId(nodeId: string): boolean {
113
113
  let nodeOverrides: string[] | undefined;
114
114
  let beforeGetNodeAllId = async () => { };
115
115
  export async function getAllNodeIds() {
116
+ await beforeGetNodeAllId();
117
+
118
+ // NOTE: We always wait for the time sync before returning any node ids. Because if we try to talk
119
+ // to remote nodes with a massively out of sync time, they will likely reject our messages!
120
+ await measureBlock(async () => {
121
+ await waitForFirstTimeSync();
122
+ }, "waitForFirstTimeSync");
123
+
116
124
  if (nodeOverrides) {
117
125
  return nodeOverrides;
118
126
  }
119
- await beforeGetNodeAllId();
120
127
  return Array.from(allNodeIds2);
121
128
  }
122
129
 
@@ -421,7 +428,7 @@ beforeGetNodeAllId = async () => {
421
428
  await discoveryReady.promise;
422
429
  };
423
430
  export async function onNodeDiscoveryReady() {
424
- await beforeGetNodeAllId();
431
+ await getAllNodeIds();
425
432
  }
426
433
  if (isServer()) {
427
434
  setImmediate(() => {