paid-services 4.2.2 → 4.3.0
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
|
@@ -80,6 +80,12 @@ const uniq = arr => Array.from(new Set(arr));
|
|
|
80
80
|
ids: [<Joined Member Public Key Hex String>]
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
+
// A member signaled they were present
|
|
84
|
+
@event 'present'
|
|
85
|
+
{
|
|
86
|
+
id: <Present Member Public Key Hex String>
|
|
87
|
+
}
|
|
88
|
+
|
|
83
89
|
// A member submitted their partial signature
|
|
84
90
|
@event 'signing'
|
|
85
91
|
{
|
|
@@ -182,6 +188,9 @@ module.exports = ({capacity, count, identity, lnd, members, rate}) => {
|
|
|
182
188
|
// Add the group member details to the group
|
|
183
189
|
group.members.push({id: req.from, last_joined: new Date().toISOString()});
|
|
184
190
|
|
|
191
|
+
// Notify that the member is present
|
|
192
|
+
group.emitter.emit('present', {id: req.from});
|
|
193
|
+
|
|
185
194
|
// Exit with failure when a member dropped out after being locked in
|
|
186
195
|
if (!!group.ids && group.members.length < count) {
|
|
187
196
|
return res.failure([503, 'GroupMemberExited']);
|
|
@@ -61,6 +61,12 @@ const times = 2 * 60 * 10;
|
|
|
61
61
|
ids: [<Group Member Identity Public Key Hex String>]
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
+
// Member is present
|
|
65
|
+
@event 'present'
|
|
66
|
+
{
|
|
67
|
+
id: <Present Member Public Id Hex String>
|
|
68
|
+
}
|
|
69
|
+
|
|
64
70
|
// Members proposed channels to each other
|
|
65
71
|
@event 'proposed'
|
|
66
72
|
{}
|
|
@@ -174,6 +180,9 @@ module.exports = ({capacity, count, ecp, identity, lnd, members, rate}) => {
|
|
|
174
180
|
}
|
|
175
181
|
});
|
|
176
182
|
|
|
183
|
+
// Relay presence notifications
|
|
184
|
+
coordinator.events.on('present', ({id}) => emitter.emit('present', {id}));
|
|
185
|
+
|
|
177
186
|
// Group members have submitted their partial signatures
|
|
178
187
|
coordinator.events.once('signed', async () => {
|
|
179
188
|
// Collect all the partially signed PSBTs
|
|
@@ -19,7 +19,9 @@ const maxGroupSize = 420;
|
|
|
19
19
|
const minChannelSize = 2e4;
|
|
20
20
|
const minGroupSize = 2;
|
|
21
21
|
const niceName = ({alias, id}) => `${alias} ${id}`.trim();
|
|
22
|
+
const {now} = Date;
|
|
22
23
|
const signPsbtEndpoint = '/walletrpc.WalletKit/SignPsbt';
|
|
24
|
+
const staleMs = 1000 * 60 * 5;
|
|
23
25
|
|
|
24
26
|
/** Create a channel group
|
|
25
27
|
|
|
@@ -137,6 +139,7 @@ module.exports = (args, cbk) => {
|
|
|
137
139
|
'getIdentity',
|
|
138
140
|
({ecp, getIdentity}, cbk) =>
|
|
139
141
|
{
|
|
142
|
+
const announced = [];
|
|
140
143
|
const members = [getIdentity.public_key].concat(args.members);
|
|
141
144
|
|
|
142
145
|
const coordinate = assembleChannelGroup({
|
|
@@ -153,6 +156,29 @@ module.exports = (args, cbk) => {
|
|
|
153
156
|
|
|
154
157
|
args.logger.info({group_invite_code: code});
|
|
155
158
|
|
|
159
|
+
// Members will join the group
|
|
160
|
+
coordinate.events.on('present', async ({id}) => {
|
|
161
|
+
const alreadyAnnounced = announced.slice().reverse().find(node => {
|
|
162
|
+
return node.id === id;
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
// Exit early when already announced
|
|
166
|
+
if (!!alreadyAnnounced && (now() - alreadyAnnounced.at) < staleMs) {
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
announced.push({at: now(), id});
|
|
171
|
+
|
|
172
|
+
// Maintain a fixed size of announced members
|
|
173
|
+
if (announced.length > args.count) {
|
|
174
|
+
announced.shift();
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
const joined = await getNodeAlias({id, lnd: args.lnd});
|
|
178
|
+
|
|
179
|
+
return args.logger.info({at: new Date(), ready: niceName(joined)});
|
|
180
|
+
});
|
|
181
|
+
|
|
156
182
|
// The group must fill up with participants first
|
|
157
183
|
coordinate.events.once('filled', async ({ids}) => {
|
|
158
184
|
const members = ids.filter(n => n !== getIdentity.public_key);
|
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.
|
|
50
|
+
"version": "4.3.0"
|
|
51
51
|
}
|