trac-msb 0.1.21 → 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.
- package/Whitelist/pubkeys.csv +1 -1
- package/msb.mjs +2 -2
- package/package.json +1 -1
- package/src/index.js +16 -15
- package/src/utils/constants.js +1 -1
- package/src/utils/msgUtils.js +1 -6
package/Whitelist/pubkeys.csv
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
bcda78165dd38ca98045a6f4b0d19f2e1a465d83c7fc6ac052a64802ca163986
|
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: '
|
|
7
|
-
channel: '
|
|
6
|
+
bootstrap: '1e8bf2005085e3730c4869ebc1c0564aad34fb16e98dd2242921cb6a02a2d845',
|
|
7
|
+
channel: '00axtracnetworkmainsettlementbut'
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
const msb = new MainSettlementBus(opts);
|
package/package.json
CHANGED
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,29 +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
|
-
|
|
895
|
-
|
|
896
|
-
|
|
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
|
+
_this.#validator_stream.on('open', () => {
|
|
905
|
+
_this.#validator = pubKey;
|
|
906
|
+
console.log('Stream established', pubKey);
|
|
907
|
+
});
|
|
908
|
+
|
|
904
909
|
_this.#validator_stream.on('close', () => {
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
console.log('Stream closed', pubKey);
|
|
909
|
-
}
|
|
910
|
+
_this.#validator_stream = null;
|
|
911
|
+
_this.#validator = null;
|
|
912
|
+
console.log('Stream closed', pubKey);
|
|
910
913
|
});
|
|
911
914
|
|
|
912
915
|
_this.#validator_stream.on('error', (err) => {
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
_this.#validator = null;
|
|
916
|
-
}
|
|
916
|
+
_this.#validator_stream = null;
|
|
917
|
+
_this.#validator = null;
|
|
917
918
|
});
|
|
918
919
|
}
|
|
919
920
|
}
|
package/src/utils/constants.js
CHANGED
|
@@ -6,7 +6,7 @@ export const EntryType = Object.freeze({
|
|
|
6
6
|
|
|
7
7
|
export const OperationType = Object.freeze({
|
|
8
8
|
ADD_ADMIN: 'addAdmin',
|
|
9
|
-
APPEND_WHITELIST: '
|
|
9
|
+
APPEND_WHITELIST: 'appendWhitelist',
|
|
10
10
|
ADD_WRITER: 'addWriter',
|
|
11
11
|
REMOVE_WRITER: 'removeWriter',
|
|
12
12
|
ADD_INDEXER: 'addIndexer',
|
package/src/utils/msgUtils.js
CHANGED
|
@@ -3,12 +3,7 @@ import { OperationType } from './constants.js';
|
|
|
3
3
|
import fileUtils from './fileUtils.js';
|
|
4
4
|
import b4a from 'b4a';
|
|
5
5
|
import Wallet from 'trac-wallet';
|
|
6
|
-
|
|
7
|
-
// It is responsible for creating messages, verifying them, reading public keys from a file, etc.
|
|
8
|
-
// It would be better to separate these concerns into different classes or modules.
|
|
9
|
-
// For example, we could have a separate class for file operations, another for message creation, etc.
|
|
10
|
-
// This would make the code more modular and easier to maintain.
|
|
11
|
-
// It would also make it easier to create tests and mocks in the future.
|
|
6
|
+
|
|
12
7
|
class MsgUtils {
|
|
13
8
|
|
|
14
9
|
static createMessage(...args) {
|