trac-msb 0.1.22 → 0.1.23

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.
Files changed (3) hide show
  1. package/msb.mjs +2 -2
  2. package/package.json +1 -1
  3. package/src/index.js +12 -18
package/msb.mjs CHANGED
@@ -3,8 +3,8 @@ 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: '4577ebf1e84c06d48b2caa33fe54ae58be3a79cb30810129d58b725fae412e37',
7
- channel: '00axtracnetworkmainsettlementbus'
6
+ bootstrap: '1e8bf2005085e3730c4869ebc1c0564aad34fb16e98dd2242921cb6a02a2d845',
7
+ channel: '00axtracnetworkmainsettlementbut'
8
8
  };
9
9
 
10
10
  const msb = new MainSettlementBus(opts);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "trac-msb",
3
3
  "main": "msb.mjs",
4
- "version": "0.1.22",
4
+ "version": "0.1.23",
5
5
  "pear": {
6
6
  "name": "trac-msb",
7
7
  "type": "terminal"
package/src/index.js CHANGED
@@ -856,6 +856,8 @@ export class MainSettlementBus extends ReadyResource {
856
856
  const lengthEntry = await this.#base.view.get('wrl');
857
857
  const length = lengthEntry?.value ?? 0;
858
858
 
859
+ console.log('Looking for available writers, please wait...');
860
+
859
861
  async function findValidator(_this) {
860
862
  if (_this.#validator_stream !== null) return;
861
863
 
@@ -891,36 +893,28 @@ export class MainSettlementBus extends ReadyResource {
891
893
  _this.#validator_stream = existing_stream;
892
894
  _this.#validator = pubKey;
893
895
  _this.#validator_stream.on('close', () => {
894
- if(_this.#validator_stream !== null && b4a.toString(_this.#validator_stream.publicKey, 'hex') === pubKey){
895
- _this.#validator_stream = null;
896
- _this.#validator = null;
897
- console.log('Exissting Stream closed', pubKey);
898
- }
896
+ _this.#validator_stream = null;
897
+ _this.#validator = null;
898
+ console.log('Existing Stream closed', pubKey);
899
899
  });
900
900
  console.log('Existing Stream established', pubKey);
901
901
  } else {
902
902
  _this.#validator_stream = _this.#dht_node.connect(b4a.from(pubKey, 'hex'));
903
903
 
904
904
  _this.#validator_stream.on('open', () => {
905
- if(_this.#validator_stream !== null && b4a.toString(_this.#validator_stream.publicKey, 'hex') === pubKey){
906
- _this.#validator = pubKey;
907
- console.log('Stream established', pubKey);
908
- }
905
+ _this.#validator = pubKey;
906
+ console.log('Stream established', pubKey);
909
907
  });
910
908
 
911
909
  _this.#validator_stream.on('close', () => {
912
- if(_this.#validator_stream !== null && b4a.toString(_this.#validator_stream.publicKey, 'hex') === pubKey){
913
- _this.#validator_stream = null;
914
- _this.#validator = null;
915
- console.log('Stream closed', pubKey);
916
- }
910
+ _this.#validator_stream = null;
911
+ _this.#validator = null;
912
+ console.log('Stream closed', pubKey);
917
913
  });
918
914
 
919
915
  _this.#validator_stream.on('error', (err) => {
920
- if(_this.#validator_stream !== null && b4a.toString(_this.#validator_stream.publicKey, 'hex') === pubKey) {
921
- _this.#validator_stream = null;
922
- _this.#validator = null;
923
- }
916
+ _this.#validator_stream = null;
917
+ _this.#validator = null;
924
918
  });
925
919
  }
926
920
  }