capitalisk-dex 17.3.0 → 17.3.1

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,7 +1,7 @@
1
1
  module.exports = {
2
2
  passiveMode: false,
3
3
  priceDecimalPrecision: null,
4
- initRetryDelay: 5000,
4
+ initRetryDelay: 20000,
5
5
  multisigExpiry: 86400000,
6
6
  multisigExpiryCheckInterval: 60000,
7
7
  multisigFlushInterval: 15000,
package/index.js CHANGED
@@ -21,7 +21,7 @@ const { CAPITALISK_DEX_PASSWORD } = process.env;
21
21
  const CIPHER_ALGORITHM = 'aes-192-cbc';
22
22
  const CIPHER_KEY = CAPITALISK_DEX_PASSWORD ? crypto.scryptSync(CAPITALISK_DEX_PASSWORD, 'salt', 24) : undefined;
23
23
  const CIPHER_IV = Buffer.alloc(16, 0);
24
- const DEFAULT_INIT_RETRY_DELAY = 5000;
24
+ const DEFAULT_INIT_RETRY_DELAY = 20000;
25
25
  const DEFAULT_MULTISIG_READY_DELAY = 5000;
26
26
  const DEFAULT_MULTISIG_RETRY_INTERVAL = 60000;
27
27
  const DEFAULT_SIGNATURE_READY_DELAY = 10000;
@@ -1203,7 +1203,7 @@ module.exports = class CapitaliskDEXModule {
1203
1203
  `Failed to load initial snapshot because of error: ${error.message} - DEX node will start with an empty order book`
1204
1204
  );
1205
1205
 
1206
- while (!this.processedHeights[this.baseChainSymbol] || !this.processedHeights[this.quoteChainSymbol]) {
1206
+ while (true) {
1207
1207
  try {
1208
1208
  let [baseMaxHeight, quoteMaxHeight] = await Promise.all([
1209
1209
  this._getMaxBlockHeight(this.baseChainSymbol, false),
@@ -1216,31 +1216,37 @@ module.exports = class CapitaliskDEXModule {
1216
1216
  this.logger.error(`The ${this.quoteChainSymbol} chain had a height of 0`);
1217
1217
  }
1218
1218
  if (!baseMaxHeight || !quoteMaxHeight) {
1219
- this.logger.debug('Retrying chain time initialization...');
1220
- await wait(this.initRetryDelay);
1221
- continue;
1219
+ throw new Error('Invalid chain heights');
1222
1220
  }
1223
1221
  this.processedHeights[this.baseChainSymbol] = baseMaxHeight;
1224
1222
  this.processedHeights[this.quoteChainSymbol] = quoteMaxHeight;
1225
- } catch (orderBookInitError) {
1226
- throw new Error(
1227
- `Failed to initialize new order book because of error: ${orderBookInitError.message}`
1223
+ break;
1224
+ } catch (initHeightError) {
1225
+ this.logger.error(
1226
+ `Failed to initialize last processed heights because of error: ${initHeightError.message}`
1228
1227
  );
1228
+ this.logger.debug('Retrying initialization of last processed heights...');
1229
+ await wait(this.initRetryDelay);
1229
1230
  }
1230
1231
  }
1231
1232
  }
1232
1233
 
1233
- try {
1234
- let [baseChainMaxBlock, quoteChainMaxBlock] = await Promise.all([
1235
- this._getBlockAtHeight(this.baseChainSymbol, this.processedHeights[this.baseChainSymbol]),
1236
- this._getBlockAtHeight(this.quoteChainSymbol, this.processedHeights[this.quoteChainSymbol])
1237
- ]);
1238
- this.lastProcessedBlocks[this.baseChainSymbol] = baseChainMaxBlock;
1239
- this.lastProcessedBlocks[this.quoteChainSymbol] = quoteChainMaxBlock;
1240
- } catch (error) {
1241
- throw new Error(
1242
- `Failed to load last processed blocks because of error: ${error.message}`
1243
- );
1234
+ while (true) {
1235
+ try {
1236
+ let [baseChainMaxBlock, quoteChainMaxBlock] = await Promise.all([
1237
+ this._getBlockAtHeight(this.baseChainSymbol, this.processedHeights[this.baseChainSymbol]),
1238
+ this._getBlockAtHeight(this.quoteChainSymbol, this.processedHeights[this.quoteChainSymbol])
1239
+ ]);
1240
+ this.lastProcessedBlocks[this.baseChainSymbol] = baseChainMaxBlock;
1241
+ this.lastProcessedBlocks[this.quoteChainSymbol] = quoteChainMaxBlock;
1242
+ break;
1243
+ } catch (error) {
1244
+ this.logger.error(
1245
+ `Failed to initialize last processed blocks because of error: ${error.message}`
1246
+ );
1247
+ this.logger.debug('Retrying initialization of last processed blocks...');
1248
+ await wait(this.initRetryDelay);
1249
+ }
1244
1250
  }
1245
1251
 
1246
1252
  await Promise.all(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "capitalisk-dex",
3
- "version": "17.3.0",
3
+ "version": "17.3.1",
4
4
  "description": "Decentralized exchange module.",
5
5
  "main": "index.js",
6
6
  "scripts": {