trac-msb 0.1.46 → 0.1.47

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 +1 @@
1
- b6dd6cb05af9cbb0cea3d2c3e6e56dbda5fd86834501f621c5a874d587e4878f
1
+ b9b6180146d1ad25874a73951e81bef08bd665a349431a56266afdc8f1c36a9c
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "trac-msb",
3
3
  "main": "msb.mjs",
4
- "version": "0.1.46",
4
+ "version": "0.1.47",
5
5
  "pear": {
6
6
  "name": "trac-msb",
7
7
  "type": "terminal"
package/src/index.js CHANGED
@@ -760,7 +760,11 @@ export class MainSettlementBus extends ReadyResource {
760
760
 
761
761
  async tryConnection(address, type = 'validator'){
762
762
  if(null === this.#swarm) return null;
763
-
763
+ if(this.#network.validator_stream !== null && address !== b4a.toString(this.#network.validator_stream.remotePublicKey, 'hex')){
764
+ this.#swarm.leavePeer(this.#network.validator_stream.remotePublicKey);
765
+ this.#network.validator_stream = null;
766
+ this.#network.validator = null;
767
+ }
764
768
  // trying to join a peer from the global swarm
765
769
  if(false === this.#swarm.peers.has(address)){
766
770
  this.#swarm.joinPeer(b4a.from(address, 'hex'));