Skip to content

Commit 6d07447

Browse files
fix: remove useless orderbook fetching
1 parent 543a548 commit 6d07447

File tree

1 file changed

+8
-25
lines changed

1 file changed

+8
-25
lines changed

packages/sdk/src/lib/dataProtectorCore/processProtectedData.ts

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -227,37 +227,21 @@ export const processProtectedData = async <
227227
}
228228
return desiredPriceAppOrder;
229229
}),
230-
// Fetch workerpool order for App or AppWhitelist
231-
Promise.all([
232-
// for app
233-
iexec.orderbook.fetchWorkerpoolOrderbook({
234-
workerpool: vWorkerpool,
235-
app: vApp,
236-
dataset: vProtectedData,
237-
requester: requester, // public orders + user specific orders
238-
isRequesterStrict: useVoucher, // If voucher, we only want user specific orders
239-
minTag: ['tee', 'scone'],
240-
maxTag: ['tee', 'scone'],
241-
category: 0,
242-
}),
243-
// for app whitelist
244-
iexec.orderbook.fetchWorkerpoolOrderbook({
230+
// Fetch workerpool order for App
231+
iexec.orderbook
232+
.fetchWorkerpoolOrderbook({
245233
workerpool: vWorkerpool === ethers.ZeroAddress ? 'any' : vWorkerpool,
246-
app: vUserWhitelist,
234+
app: vApp,
247235
dataset: vProtectedData,
248236
requester: requester, // public orders + user specific orders
249237
isRequesterStrict: useVoucher, // If voucher, we only want user specific orders
250238
minTag: ['tee', 'scone'],
251239
maxTag: ['tee', 'scone'],
252240
category: 0,
253-
}),
254-
]).then(
255-
([workerpoolOrderbookForApp, workerpoolOrderbookForAppWhitelist]) => {
241+
})
242+
.then((workerpoolOrderbook) => {
256243
const desiredPriceWorkerpoolOrder = filterWorkerpoolOrders({
257-
workerpoolOrders: [
258-
...workerpoolOrderbookForApp.orders,
259-
...workerpoolOrderbookForAppWhitelist.orders,
260-
],
244+
workerpoolOrders: workerpoolOrderbook.orders,
261245
workerpoolMaxPrice: vWorkerpoolMaxPrice,
262246
useVoucher: vUseVoucher,
263247
userVoucher,
@@ -266,8 +250,7 @@ export const processProtectedData = async <
266250
throw new Error('No Workerpool order found for the desired price');
267251
}
268252
return desiredPriceWorkerpoolOrder;
269-
}
270-
),
253+
}),
271254
]);
272255

273256
if (!workerpoolorder) {

0 commit comments

Comments
 (0)