paid-services 4.0.1 → 4.0.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Versions
2
2
 
3
+ ## Version 4.0.2
4
+
5
+ - `manageTrades`: Fix connection to seller failing
6
+
3
7
  ## Version 4.0.1
4
8
 
5
9
  - `createGroupChannel`: Add method to coordinate a channel group
package/package.json CHANGED
@@ -47,5 +47,5 @@
47
47
  "integration-tests": "tap -j 2 --branches=1 --functions=1 --lines=1 --statements=1 -t 180 test/integration/*.js",
48
48
  "test": "tap --branches=1 --functions=1 --lines=1 --statements=1 -t 60 test/actions/*.js test/balanced/*.js test/capacity/*.js test/client/*.js test/config/*.js test/p2p/*.js test/records/*.js test/respond/*.js test/server/*.js test/swaps/*.js test/services/*.js test/trades/*.js"
49
49
  },
50
- "version": "4.0.1"
50
+ "version": "4.0.2"
51
51
  }
@@ -15,7 +15,7 @@ const {returnResult} = require('asyncjs-util');
15
15
 
16
16
  const interval = 1000;
17
17
  const {isArray} = Array;
18
- const times = 10;
18
+ const times = 20;
19
19
  const uniq = arr => Array.from(new Set(arr));
20
20
 
21
21
  /** Connect to a seller
@@ -213,7 +213,7 @@ module.exports = ({lnd, logger, nodes}, cbk) => {
213
213
 
214
214
  // Try and connect to a referenced node
215
215
  return asyncDetect(getNodes.filter(n => !!n), (node, cbk) => {
216
- logger.info({connecting_to: node.id});
216
+ logger.info({finalizing_connection_to: node.id});
217
217
 
218
218
  // Attempt referenced sockets to establish p2p connection
219
219
  return asyncDetectSeries(node.sockets, (socket, cbk) => {
@@ -244,6 +244,8 @@ module.exports = ({lnd, logger, nodes}, cbk) => {
244
244
 
245
245
  const peer = res.peers.find(n => n.public_key === connect.id);
246
246
 
247
+ logger.info({peer_connection_pending: connect.id});
248
+
247
249
  if (!peer) {
248
250
  return cbk([503, 'FailedToConnectToPeer']);
249
251
  }
@@ -2,6 +2,7 @@ const {randomBytes} = require('crypto');
2
2
 
3
3
  const asyncAuto = require('async/auto');
4
4
  const asyncReflect = require('async/reflect');
5
+ const asyncRetry = require('async/retry');
5
6
  const {returnResult} = require('asyncjs-util');
6
7
 
7
8
  const connectToSeller = require('./connect_to_seller');
@@ -16,7 +17,7 @@ const findBasicRecord = records => records.find(n => n.type === '1');
16
17
  const findIdRecord = records => records.find(n => n.type === '0');
17
18
  const {isArray} = Array;
18
19
  const makeRequestId = () => randomBytes(32).toString('hex');
19
- const requestTradesTimeoutMs = 1000 * 30;
20
+ const requestTradesTimeoutMs = 1000 * 45;
20
21
  const tradesRequestIdType = '1';
21
22
  const uniqBy = (a,b) => a.filter((e,i) => a.findIndex(n => n[b] == e[b]) == i);
22
23
  const waitForTradesMs = 1000 * 5;
@@ -72,7 +73,10 @@ module.exports = ({ask, id, lnd, logger, nodes}, cbk) => {
72
73
 
73
74
  // Connect to the seller
74
75
  connect: ['validate', ({}, cbk) => {
75
- return connectToSeller({lnd, logger, nodes}, cbk);
76
+ return asyncRetry({}, cbk => {
77
+ return connectToSeller({lnd, logger, nodes}, cbk);
78
+ },
79
+ cbk);
76
80
  }],
77
81
 
78
82
  // Send request to node with public key identity