@ocap/tx-pipeline 1.13.61 → 1.13.65
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.
@@ -2,12 +2,21 @@
|
|
2
2
|
const get = require('lodash/get');
|
3
3
|
const Error = require('@ocap/util/lib/error');
|
4
4
|
|
5
|
-
module.exports = function CreateAntiLandAttackPipe({
|
5
|
+
module.exports = function CreateAntiLandAttackPipe({
|
6
|
+
senderState = 'senderState',
|
7
|
+
receiverState = 'receiverState',
|
8
|
+
receiverAddress = 'receiver',
|
9
|
+
} = {}) {
|
6
10
|
return function AntiLandAttack(context, next) {
|
7
11
|
const sender = get(context, senderState);
|
8
12
|
const receiver = get(context, receiverState);
|
9
13
|
|
10
|
-
if (sender.address === receiver.address) {
|
14
|
+
if (receiver && sender.address === receiver.address) {
|
15
|
+
return next(new Error('INVALID_TX', 'Sender and receiver are the same'));
|
16
|
+
}
|
17
|
+
|
18
|
+
const receiverAddr = get(context, receiverAddress);
|
19
|
+
if (sender.address === receiverAddr) {
|
11
20
|
return next(new Error('INVALID_TX', 'Sender and receiver are the same'));
|
12
21
|
}
|
13
22
|
|
@@ -19,12 +19,22 @@ const debug = require('debug')(`${require('../../package.json').name}:pipe:verif
|
|
19
19
|
module.exports = function CreateVerifyUpdaterPipe({ assetKey, ownerKey, updaterKey = 'owner' }) {
|
20
20
|
return function VerifyUpdater(context, next) {
|
21
21
|
const owner = get(context, ownerKey);
|
22
|
-
const ownerAddress = typeof owner === 'string' ? [owner] : getRelatedAddresses(owner);
|
23
|
-
const updaterKeys = typeof updaterKey === 'string' ? [updaterKey] : updaterKey;
|
24
|
-
|
25
22
|
let assets = get(context, assetKey);
|
26
23
|
assets = (Array.isArray(assets) ? assets : [assets]).filter(Boolean);
|
27
24
|
|
25
|
+
if (!owner) {
|
26
|
+
// If owner is not found, but assets is not empty, we should throw an error
|
27
|
+
if (assets.length) {
|
28
|
+
return next(new Error('INVALID_OWNER', 'Asset owner is empty', { persist: true }));
|
29
|
+
}
|
30
|
+
|
31
|
+
// Otherwise, we can continue
|
32
|
+
return next();
|
33
|
+
}
|
34
|
+
|
35
|
+
const ownerAddress = typeof owner === 'string' ? [owner] : getRelatedAddresses(owner);
|
36
|
+
const updaterKeys = typeof updaterKey === 'string' ? [updaterKey] : updaterKey;
|
37
|
+
|
28
38
|
debug('verify', { ownerAddress, assets, updaterKeys });
|
29
39
|
|
30
40
|
for (const asset of assets) {
|
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.65",
|
7
7
|
"description": "Pipeline runner and common pipelines to process transactions",
|
8
8
|
"main": "lib/index.js",
|
9
9
|
"files": [
|
@@ -26,16 +26,16 @@
|
|
26
26
|
"elliptic": "6.5.3"
|
27
27
|
},
|
28
28
|
"dependencies": {
|
29
|
-
"@arcblock/did": "1.13.
|
30
|
-
"@arcblock/did-util": "1.13.
|
31
|
-
"@ocap/mcrypto": "1.13.
|
32
|
-
"@ocap/message": "1.13.
|
33
|
-
"@ocap/state": "1.13.
|
34
|
-
"@ocap/util": "1.13.
|
35
|
-
"@ocap/wallet": "1.13.
|
29
|
+
"@arcblock/did": "1.13.65",
|
30
|
+
"@arcblock/did-util": "1.13.65",
|
31
|
+
"@ocap/mcrypto": "1.13.65",
|
32
|
+
"@ocap/message": "1.13.65",
|
33
|
+
"@ocap/state": "1.13.65",
|
34
|
+
"@ocap/util": "1.13.65",
|
35
|
+
"@ocap/wallet": "1.13.65",
|
36
36
|
"debug": "^4.3.2",
|
37
37
|
"empty-value": "^1.0.1",
|
38
38
|
"lodash": "^4.17.21"
|
39
39
|
},
|
40
|
-
"gitHead": "
|
40
|
+
"gitHead": "4011996e1800845142aa5c889b58726129a99ec3"
|
41
41
|
}
|