@ocap/tx-protocols 1.13.12 → 1.13.16
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/lib/protocols/rollup/create-block.js +11 -4
- package/package.json +12 -12
|
@@ -204,11 +204,18 @@ runner.use(({ itx, txs, previousBlock, signerStates, rollupState }, next) => {
|
|
|
204
204
|
}
|
|
205
205
|
|
|
206
206
|
// ensure checkpoint: between previous block checkpoint and current block checkpoint
|
|
207
|
-
const
|
|
208
|
-
|
|
209
|
-
|
|
207
|
+
const mustBefore = itx.checkpoint;
|
|
208
|
+
let mustAfter = rollupState.context.genesisTime;
|
|
209
|
+
if (previousBlock) {
|
|
210
|
+
// Here we allow a new block to include transactions before previous block is committed
|
|
211
|
+
// Since on some conditions, the previous block may missed some transactions
|
|
212
|
+
const time = new Date(previousBlock.checkpoint).getTime() - rollupState.minBlockInterval * 1000;
|
|
213
|
+
mustAfter = new Date(time).toISOString();
|
|
214
|
+
}
|
|
215
|
+
const isBetween = (x) => x.time >= mustAfter && x.time < mustBefore;
|
|
216
|
+
const invalidEndpointTx = txs.some((x) => isBetween(x) === false);
|
|
210
217
|
if (invalidEndpointTx) {
|
|
211
|
-
return next(new Error('INVALID_TX', `Rollup block can only include tx
|
|
218
|
+
return next(new Error('INVALID_TX', `Rollup block can only include tx between ${mustAfter} and ${mustBefore}`));
|
|
212
219
|
}
|
|
213
220
|
|
|
214
221
|
// FIXME: (production) ensure no missing tx after checkpoint
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.13.
|
|
6
|
+
"version": "1.13.16",
|
|
7
7
|
"description": "Predefined tx pipeline sets to execute certain type of transactions",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"files": [
|
|
@@ -19,16 +19,16 @@
|
|
|
19
19
|
"author": "wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)",
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@arcblock/did": "1.13.
|
|
23
|
-
"@arcblock/did-util": "1.13.
|
|
24
|
-
"@ocap/asset": "1.13.
|
|
25
|
-
"@ocap/mcrypto": "1.13.
|
|
26
|
-
"@ocap/merkle-tree": "1.13.
|
|
27
|
-
"@ocap/message": "1.13.
|
|
28
|
-
"@ocap/state": "1.13.
|
|
29
|
-
"@ocap/tx-pipeline": "1.13.
|
|
30
|
-
"@ocap/util": "1.13.
|
|
31
|
-
"@ocap/wallet": "1.13.
|
|
22
|
+
"@arcblock/did": "1.13.16",
|
|
23
|
+
"@arcblock/did-util": "1.13.16",
|
|
24
|
+
"@ocap/asset": "1.13.16",
|
|
25
|
+
"@ocap/mcrypto": "1.13.16",
|
|
26
|
+
"@ocap/merkle-tree": "1.13.16",
|
|
27
|
+
"@ocap/message": "1.13.16",
|
|
28
|
+
"@ocap/state": "1.13.16",
|
|
29
|
+
"@ocap/tx-pipeline": "1.13.16",
|
|
30
|
+
"@ocap/util": "1.13.16",
|
|
31
|
+
"@ocap/wallet": "1.13.16",
|
|
32
32
|
"debug": "^4.3.2",
|
|
33
33
|
"empty-value": "^1.0.1",
|
|
34
34
|
"lodash": "^4.17.21",
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"jest": "^26.6.3"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "7b5bdaf7b0404fa5d59c4160ab986e2dc6c565a3"
|
|
45
45
|
}
|