trac-msb 0.0.90 → 0.0.91

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.
@@ -1,3 +1,3 @@
1
- 94c8c67ab75fd572216e0d7152c788014fcd17b57f1c8c37a5229183093aba7e
2
- 882080f2492e2821ebdedb72d2a0e94dd62e38b01d877916c00c3bd13383bfc5
3
- 61daeeb9db08a6b82ddc5c0552674e4fc26c01055aeedb2d50e29119bef0886a
1
+ 3e84de76f23d1f8f47aa5f133cb928ead44f91429df0b3f9761205049f2beeec
2
+ bd3c9c5844187407baf418c3aa6329c364297b895f961a1f88a91bfe666f72c2
3
+ 17e1856a71e2aef8be3dcb6776316cf90d339f8cab9bcbb3c356be2da86fd2e7
package/msb.mjs CHANGED
@@ -3,7 +3,7 @@ import {MainSettlementBus} from './src/index.js';
3
3
  const opts = {
4
4
  stores_directory : 'stores/',
5
5
  store_name : typeof process !== "undefined" ? process.argv[2] : Pear.config.args[0],
6
- bootstrap: '07814eb54b2a3ebf61506f056fa1235d11431fcfb6505dccfa880146938093a6',
6
+ bootstrap: '4577ebf1e84c06d48b2caa33fe54ae58be3a79cb30810129d58b725fae412e37',
7
7
  channel: '00axtracnetworkmainsettlementbus',
8
8
  tx : 'axtracnetworkmainsettlementbustx'
9
9
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "trac-msb",
3
3
  "main": "msb.mjs",
4
- "version": "0.0.90",
4
+ "version": "0.0.91",
5
5
  "pear": {
6
6
  "name": "trac-msb",
7
7
  "type": "terminal"
@@ -57,7 +57,7 @@
57
57
  "hypercore": "11.1.2",
58
58
  "hypercore-crypto": "3.4.0",
59
59
  "hyperdht": "^6.20.1",
60
- "hyperswarm": "4.11.1",
60
+ "hyperswarm": "4.11.4",
61
61
  "inspector": "npm:bare-node-inspector",
62
62
  "is-options": "1.0.2",
63
63
  "module": "npm:bare-node-module",
package/src/index.js CHANGED
@@ -382,7 +382,7 @@ export class MainSettlementBus extends ReadyResource {
382
382
  this.#writerEventListener(); // only for writers
383
383
  }
384
384
 
385
- await this.#setUpRoleAutomatically(adminEntry);
385
+ //await this.#setUpRoleAutomatically(adminEntry);
386
386
 
387
387
  if (this.#enable_updater) {
388
388
  this.updater();// TODO: NODE AFTER BECOMING A writer should start the updater
@@ -395,6 +395,7 @@ export class MainSettlementBus extends ReadyResource {
395
395
  }
396
396
 
397
397
  async close() {
398
+ console.log('Closing everything...');
398
399
  if (this.#swarm) {
399
400
  await this.#swarm.destroy();
400
401
  }
package/src/network.js CHANGED
@@ -7,6 +7,7 @@ import {
7
7
  MAX_PEERS,
8
8
  MAX_PARALLEL,
9
9
  MAX_SERVER_CONNECTIONS,
10
+ MAX_CLIENT_CONNECTIONS,
10
11
  OperationType,
11
12
  EntryType
12
13
  } from './utils/constants.js';
@@ -36,7 +37,7 @@ class Network {
36
37
  };
37
38
  }
38
39
 
39
- swarm = new Hyperswarm({ keyPair, bootstrap, maxPeers: MAX_PEERS, maxParallel: MAX_PARALLEL, maxServerConnections: MAX_SERVER_CONNECTIONS });
40
+ swarm = new Hyperswarm({ keyPair, bootstrap : bootstrap, maxPeers: MAX_PEERS, maxParallel: MAX_PARALLEL, maxServerConnections: MAX_SERVER_CONNECTIONS, maxClientConnections : MAX_CLIENT_CONNECTIONS});
40
41
 
41
42
  console.log(`Channel: ${b4a.toString(channel)}`);
42
43
  swarm.on('connection', async (connection) => {
@@ -53,9 +54,16 @@ class Network {
53
54
  }
54
55
  });
55
56
 
56
- swarm.join(channel, { server: true, client: true });
57
+ const discovery = swarm.join(channel, { server: true, client: true });
57
58
  await swarm.flush();
58
- console.log('Joined channel for peer discovery');
59
+ console.log('Joined channel');
60
+ async function refresh(){
61
+ await discovery.refresh();
62
+ setTimeout(function(){
63
+ refresh();
64
+ }, 30_000);
65
+ }
66
+ await refresh();
59
67
  }
60
68
  return swarm;
61
69
  }
@@ -35,9 +35,10 @@ export const MAX_INDEXERS = 3;
35
35
  export const MIN_INDEXERS = 1;
36
36
  export const ACK_INTERVAL = 1000;
37
37
  export const WHITELIST_SLEEP_INTERVAL = 100;
38
- export const MAX_PEERS = 1024;
39
- export const MAX_PARALLEL = 512;
40
- export const MAX_SERVER_CONNECTIONS = 256;
38
+ export const MAX_PEERS = 8;
39
+ export const MAX_PARALLEL = 8;
40
+ export const MAX_SERVER_CONNECTIONS = 4;
41
+ export const MAX_CLIENT_CONNECTIONS = 4;
41
42
  export const UPDATER_INTERVAL = 10_000;
42
43
 
43
44
  const constants = {