@leofcoin/workers 1.2.1 → 1.2.3
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/dist/bundle/commonjs/{machine-worker-e96e3082.js → machine-worker-921195af.js} +24 -26
- package/dist/bundle/commonjs/machine-worker.js +1 -1
- package/dist/bundle/commonjs/workers.js +1 -1
- package/dist/bundle/module/{machine-worker-e3020b69.js → machine-worker-73a4ed96.js} +24 -26
- package/dist/bundle/module/machine-worker.js +1 -1
- package/dist/bundle/module/workers.js +1 -1
- package/dist/commonjs/{machine-worker-16dad57f.js → machine-worker-883fbad2.js} +24 -26
- package/dist/commonjs/machine-worker.js +1 -1
- package/dist/commonjs/workers.js +1 -1
- package/dist/module/{machine-worker-a2897101.js → machine-worker-a213bc02.js} +24 -26
- package/dist/module/machine-worker.js +1 -1
- package/dist/module/workers.js +1 -1
- package/package.json +1 -1
- package/src/machine-worker.js +24 -26
|
@@ -143,33 +143,31 @@ const _init = async ({ contracts, blocks, peerid })=> {
|
|
|
143
143
|
}));
|
|
144
144
|
|
|
145
145
|
const _worker = await new worker$1.EasyWorker(require$$1.join(__dirname, './block-worker.js'), {serialization: 'advanced', type: 'module' });
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
let lastBlock;
|
|
157
|
-
if (blocks.length > 0) {
|
|
158
|
-
lastBlock = blocks[blocks.length - 1].decoded;
|
|
159
|
-
|
|
160
|
-
lastBlock = await new utils.BlockMessage(lastBlock);
|
|
161
|
-
lastBlock = {
|
|
162
|
-
...lastBlock.decoded,
|
|
163
|
-
hash: await lastBlock.hash
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
|
-
worker.postMessage({type: 'machine-ready', lastBlock });
|
|
167
|
-
_worker.terminate();
|
|
168
|
-
|
|
146
|
+
blocks = await _worker.once(blocks);
|
|
147
|
+
|
|
148
|
+
for (const block of blocks) {
|
|
149
|
+
await Promise.all(block.decoded.transactions.map(async message => {
|
|
150
|
+
const {from, to, method, params} = message;
|
|
151
|
+
globalThis.msg = createMessage(from);
|
|
152
|
+
|
|
153
|
+
await execute(to, method, params);
|
|
154
|
+
}));
|
|
155
|
+
}
|
|
169
156
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
157
|
+
let lastBlock;
|
|
158
|
+
if (blocks.length > 0) {
|
|
159
|
+
lastBlock = blocks[blocks.length - 1].decoded;
|
|
160
|
+
lastBlock = await new utils.BlockMessage(lastBlock);
|
|
161
|
+
|
|
162
|
+
lastBlock = {
|
|
163
|
+
...lastBlock.decoded,
|
|
164
|
+
hash: await lastBlock.hash
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
worker.postMessage({type: 'machine-ready', lastBlock });
|
|
168
|
+
_worker.terminate();
|
|
169
|
+
|
|
170
|
+
worker.postMessage(blocks);
|
|
173
171
|
};
|
|
174
172
|
|
|
175
173
|
const tasks = async (e) => {
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var transactionWorker = require('./transaction-worker-176a5aaa.js');
|
|
6
6
|
var blockWorker = require('./block-worker-21ad8152.js');
|
|
7
7
|
var poolWorker = require('./pool-worker-f450eeff.js');
|
|
8
|
-
var machineWorker = require('./machine-worker-
|
|
8
|
+
var machineWorker = require('./machine-worker-921195af.js');
|
|
9
9
|
require('./worker-6ace445f.js');
|
|
10
10
|
require('stream');
|
|
11
11
|
require('events');
|
|
@@ -141,33 +141,31 @@ const _init = async ({ contracts, blocks, peerid })=> {
|
|
|
141
141
|
}));
|
|
142
142
|
|
|
143
143
|
const _worker = await new EasyWorker(join(__dirname, './block-worker.js'), {serialization: 'advanced', type: 'module' });
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
let lastBlock;
|
|
155
|
-
if (blocks.length > 0) {
|
|
156
|
-
lastBlock = blocks[blocks.length - 1].decoded;
|
|
157
|
-
|
|
158
|
-
lastBlock = await new BlockMessage(lastBlock);
|
|
159
|
-
lastBlock = {
|
|
160
|
-
...lastBlock.decoded,
|
|
161
|
-
hash: await lastBlock.hash
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
worker.postMessage({type: 'machine-ready', lastBlock });
|
|
165
|
-
_worker.terminate();
|
|
166
|
-
|
|
144
|
+
blocks = await _worker.once(blocks);
|
|
145
|
+
|
|
146
|
+
for (const block of blocks) {
|
|
147
|
+
await Promise.all(block.decoded.transactions.map(async message => {
|
|
148
|
+
const {from, to, method, params} = message;
|
|
149
|
+
globalThis.msg = createMessage(from);
|
|
150
|
+
|
|
151
|
+
await execute(to, method, params);
|
|
152
|
+
}));
|
|
153
|
+
}
|
|
167
154
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
155
|
+
let lastBlock;
|
|
156
|
+
if (blocks.length > 0) {
|
|
157
|
+
lastBlock = blocks[blocks.length - 1].decoded;
|
|
158
|
+
lastBlock = await new BlockMessage(lastBlock);
|
|
159
|
+
|
|
160
|
+
lastBlock = {
|
|
161
|
+
...lastBlock.decoded,
|
|
162
|
+
hash: await lastBlock.hash
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
worker.postMessage({type: 'machine-ready', lastBlock });
|
|
166
|
+
_worker.terminate();
|
|
167
|
+
|
|
168
|
+
worker.postMessage(blocks);
|
|
171
169
|
};
|
|
172
170
|
|
|
173
171
|
const tasks = async (e) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as transactionWorker } from './transaction-worker-548cd200.js';
|
|
2
2
|
import { b as blockWorker } from './block-worker-414860e0.js';
|
|
3
3
|
import { p as poolWorker } from './pool-worker-0d927e3c.js';
|
|
4
|
-
import { m as machineWorker } from './machine-worker-
|
|
4
|
+
import { m as machineWorker } from './machine-worker-73a4ed96.js';
|
|
5
5
|
import './worker-def77c26.js';
|
|
6
6
|
import 'stream';
|
|
7
7
|
import 'events';
|
|
@@ -148,33 +148,31 @@ const _init = async ({ contracts, blocks, peerid })=> {
|
|
|
148
148
|
}));
|
|
149
149
|
|
|
150
150
|
const _worker = await new EasyWorker__default["default"](path.join(__dirname, './block-worker.js'), {serialization: 'advanced', type: 'module' });
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
let lastBlock;
|
|
162
|
-
if (blocks.length > 0) {
|
|
163
|
-
lastBlock = blocks[blocks.length - 1].decoded;
|
|
164
|
-
|
|
165
|
-
lastBlock = await new utils.BlockMessage(lastBlock);
|
|
166
|
-
lastBlock = {
|
|
167
|
-
...lastBlock.decoded,
|
|
168
|
-
hash: await lastBlock.hash
|
|
169
|
-
};
|
|
170
|
-
}
|
|
171
|
-
worker.postMessage({type: 'machine-ready', lastBlock });
|
|
172
|
-
_worker.terminate();
|
|
173
|
-
|
|
151
|
+
blocks = await _worker.once(blocks);
|
|
152
|
+
|
|
153
|
+
for (const block of blocks) {
|
|
154
|
+
await Promise.all(block.decoded.transactions.map(async message => {
|
|
155
|
+
const {from, to, method, params} = message;
|
|
156
|
+
globalThis.msg = createMessage(from);
|
|
157
|
+
|
|
158
|
+
await execute(to, method, params);
|
|
159
|
+
}));
|
|
160
|
+
}
|
|
174
161
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
162
|
+
let lastBlock;
|
|
163
|
+
if (blocks.length > 0) {
|
|
164
|
+
lastBlock = blocks[blocks.length - 1].decoded;
|
|
165
|
+
lastBlock = await new utils.BlockMessage(lastBlock);
|
|
166
|
+
|
|
167
|
+
lastBlock = {
|
|
168
|
+
...lastBlock.decoded,
|
|
169
|
+
hash: await lastBlock.hash
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
worker.postMessage({type: 'machine-ready', lastBlock });
|
|
173
|
+
_worker.terminate();
|
|
174
|
+
|
|
175
|
+
worker.postMessage(blocks);
|
|
178
176
|
};
|
|
179
177
|
|
|
180
178
|
const tasks = async (e) => {
|
package/dist/commonjs/workers.js
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var transactionWorker = require('./transaction-worker-8eecc7a1.js');
|
|
6
6
|
var blockWorker = require('./block-worker-60e4cfa3.js');
|
|
7
7
|
var poolWorker = require('./pool-worker-81e8b4c0.js');
|
|
8
|
-
var machineWorker = require('./machine-worker-
|
|
8
|
+
var machineWorker = require('./machine-worker-883fbad2.js');
|
|
9
9
|
require('@leofcoin/codec-format-interface');
|
|
10
10
|
require('./transaction-220a3a15.js');
|
|
11
11
|
require('@vandeurenglenn/easy-worker');
|
|
@@ -142,33 +142,31 @@ const _init = async ({ contracts, blocks, peerid })=> {
|
|
|
142
142
|
}));
|
|
143
143
|
|
|
144
144
|
const _worker = await new EasyWorker(join(__dirname, './block-worker.js'), {serialization: 'advanced', type: 'module' });
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
let lastBlock;
|
|
156
|
-
if (blocks.length > 0) {
|
|
157
|
-
lastBlock = blocks[blocks.length - 1].decoded;
|
|
158
|
-
|
|
159
|
-
lastBlock = await new BlockMessage(lastBlock);
|
|
160
|
-
lastBlock = {
|
|
161
|
-
...lastBlock.decoded,
|
|
162
|
-
hash: await lastBlock.hash
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
worker.postMessage({type: 'machine-ready', lastBlock });
|
|
166
|
-
_worker.terminate();
|
|
167
|
-
|
|
145
|
+
blocks = await _worker.once(blocks);
|
|
146
|
+
|
|
147
|
+
for (const block of blocks) {
|
|
148
|
+
await Promise.all(block.decoded.transactions.map(async message => {
|
|
149
|
+
const {from, to, method, params} = message;
|
|
150
|
+
globalThis.msg = createMessage(from);
|
|
151
|
+
|
|
152
|
+
await execute(to, method, params);
|
|
153
|
+
}));
|
|
154
|
+
}
|
|
168
155
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
156
|
+
let lastBlock;
|
|
157
|
+
if (blocks.length > 0) {
|
|
158
|
+
lastBlock = blocks[blocks.length - 1].decoded;
|
|
159
|
+
lastBlock = await new BlockMessage(lastBlock);
|
|
160
|
+
|
|
161
|
+
lastBlock = {
|
|
162
|
+
...lastBlock.decoded,
|
|
163
|
+
hash: await lastBlock.hash
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
worker.postMessage({type: 'machine-ready', lastBlock });
|
|
167
|
+
_worker.terminate();
|
|
168
|
+
|
|
169
|
+
worker.postMessage(blocks);
|
|
172
170
|
};
|
|
173
171
|
|
|
174
172
|
const tasks = async (e) => {
|
package/dist/module/workers.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as transactionWorker } from './transaction-worker-105deaa8.js';
|
|
2
2
|
import { b as blockWorker } from './block-worker-f539b1b2.js';
|
|
3
3
|
import { p as poolWorker } from './pool-worker-f65671d7.js';
|
|
4
|
-
import { m as machineWorker } from './machine-worker-
|
|
4
|
+
import { m as machineWorker } from './machine-worker-a213bc02.js';
|
|
5
5
|
import '@leofcoin/codec-format-interface';
|
|
6
6
|
import './transaction-d06dc6c4.js';
|
|
7
7
|
import '@vandeurenglenn/easy-worker';
|
package/package.json
CHANGED
package/src/machine-worker.js
CHANGED
|
@@ -110,33 +110,31 @@ const _init = async ({ contracts, blocks, peerid })=> {
|
|
|
110
110
|
}))
|
|
111
111
|
|
|
112
112
|
const _worker = await new EasyWorker(join(__dirname, './block-worker.js'), {serialization: 'advanced', type: 'module' })
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
let lastBlock
|
|
124
|
-
if (blocks.length > 0) {
|
|
125
|
-
lastBlock = blocks[blocks.length - 1].decoded
|
|
126
|
-
|
|
127
|
-
lastBlock = await new BlockMessage(lastBlock)
|
|
128
|
-
lastBlock = {
|
|
129
|
-
...lastBlock.decoded,
|
|
130
|
-
hash: await lastBlock.hash
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
worker.postMessage({type: 'machine-ready', lastBlock })
|
|
134
|
-
_worker.terminate()
|
|
135
|
-
|
|
113
|
+
blocks = await _worker.once(blocks)
|
|
114
|
+
|
|
115
|
+
for (const block of blocks) {
|
|
116
|
+
await Promise.all(block.decoded.transactions.map(async message => {
|
|
117
|
+
const {from, to, method, params} = message;
|
|
118
|
+
globalThis.msg = createMessage(from);
|
|
119
|
+
|
|
120
|
+
await execute(to, method, params);
|
|
121
|
+
}));
|
|
122
|
+
}
|
|
136
123
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
124
|
+
let lastBlock;
|
|
125
|
+
if (blocks.length > 0) {
|
|
126
|
+
lastBlock = blocks[blocks.length - 1].decoded;
|
|
127
|
+
lastBlock = await new BlockMessage(lastBlock);
|
|
128
|
+
|
|
129
|
+
lastBlock = {
|
|
130
|
+
...lastBlock.decoded,
|
|
131
|
+
hash: await lastBlock.hash
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
worker.postMessage({type: 'machine-ready', lastBlock });
|
|
135
|
+
_worker.terminate();
|
|
136
|
+
|
|
137
|
+
worker.postMessage(blocks);
|
|
140
138
|
}
|
|
141
139
|
|
|
142
140
|
const tasks = async (e) => {
|