paid-services 5.0.3 → 5.0.4

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,6 +1,6 @@
1
1
  # Versions
2
2
 
3
- ## Version 5.0.3
3
+ ## Version 5.0.4
4
4
 
5
5
  - `createGroupChannel`, `joinGroupChannel`, `manageGroupJoin`: Double check
6
6
  open channel acceptance when peering
@@ -7,6 +7,7 @@ const {decodePsbt} = require('psbt');
7
7
  const {extendPsbt} = require('psbt');
8
8
  const {fundPendingChannels} = require('ln-service');
9
9
  const {getChainFeeRate} = require('ln-service');
10
+ const {getHeight} = require('ln-service');
10
11
  const {getMaxFundAmount} = require('ln-sync');
11
12
  const {getPendingChannels} = require('ln-service');
12
13
  const {partiallySignPsbt} = require('ln-service');
@@ -19,6 +20,7 @@ const {unextractTransaction} = require('psbt');
19
20
 
20
21
  const bufferAsHex = buffer => buffer.toString('hex');
21
22
  const {concat} = Buffer;
23
+ const defaultBlocksBuffer = 18;
22
24
  const dummySignature = Buffer.alloc(1);
23
25
  const format = 'p2wpkh';
24
26
  const {from} = Buffer;
@@ -30,6 +32,7 @@ const hexAsBuf = hex => Buffer.from(hex, 'hex');
30
32
  const inputAsOutpoint = n => `${n.transaction_id}:${n.transaction_vout}`;
31
33
  const interval = 10;
32
34
  const {isArray} = Array;
35
+ const minSequence = 0;
33
36
  const notEmpty = arr => arr.filter(n => !!n);
34
37
  const {p2wpkh} = payments;
35
38
  const {random} = Math;
@@ -94,6 +97,9 @@ module.exports = ({id, lnd, psbt, utxos}, cbk) => {
94
97
  return createChainAddress({format, lnd}, cbk);
95
98
  }],
96
99
 
100
+ // Get the current block height to use in transaction nlocktime
101
+ getHeight: ['validate', ({}, cbk) => getHeight({lnd}, cbk)],
102
+
97
103
  // Get the conflicting tx fee rate
98
104
  getRate: ['validate', ({}, cbk) => {
99
105
  return getChainFeeRate({lnd, confirmation_target: slowConf}, cbk);
@@ -125,7 +131,8 @@ module.exports = ({id, lnd, psbt, utxos}, cbk) => {
125
131
  'createConflictAddress',
126
132
  'ecp',
127
133
  'getConflictAmount',
128
- ({createConflictAddress, ecp, getConflictAmount}, cbk) =>
134
+ 'getHeight',
135
+ ({createConflictAddress, ecp, getConflictAmount, getHeight}, cbk) =>
129
136
  {
130
137
  const hash = fromBech32(createConflictAddress.address).data;
131
138
  const [input] = utxos;
@@ -135,8 +142,10 @@ module.exports = ({id, lnd, psbt, utxos}, cbk) => {
135
142
  script: bufferAsHex(p2wpkh({hash}).output),
136
143
  tokens: getConflictAmount.max_tokens,
137
144
  }],
145
+ timelock: getHeight.current_block_height + defaultBlocksBuffer,
138
146
  utxos: [{
139
147
  id: input.transaction_id,
148
+ sequence: minSequence,
140
149
  vout: input.transaction_vout,
141
150
  }],
142
151
  });
package/package.json CHANGED
@@ -17,7 +17,7 @@
17
17
  "goldengate": "12.0.5",
18
18
  "invoices": "2.2.3",
19
19
  "ln-service": "56.3.0",
20
- "ln-sync": "5.1.0",
20
+ "ln-sync": "5.2.0",
21
21
  "psbt": "2.7.2",
22
22
  "p2tr": "1.3.3",
23
23
  "tiny-secp256k1": "2.2.1"
@@ -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": "5.0.3"
50
+ "version": "5.0.4"
51
51
  }