trac-msb 0.0.22 → 0.0.24
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/package.json +1 -1
- package/src/index.js +5 -9
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -67,8 +67,8 @@ export class MainSettlementBus extends ReadyResource {
|
|
|
67
67
|
if (null === await view.get(op.key) &&
|
|
68
68
|
sanitizeTransaction(postTx) &&
|
|
69
69
|
postTx.op === 'post-tx' &&
|
|
70
|
-
crypto.verify(Buffer.from(postTx.tx
|
|
71
|
-
crypto.verify(Buffer.from(postTx.tx
|
|
70
|
+
crypto.verify(Buffer.from(postTx.tx, 'utf-8'), Buffer.from(postTx.is, 'hex'), Buffer.from(postTx.ipk, 'hex')) &&// sender verification
|
|
71
|
+
crypto.verify(Buffer.from(postTx.tx, 'utf-8'), Buffer.from(postTx.ws, 'hex'), Buffer.from(postTx.wp, 'hex')) &&// writer verification
|
|
72
72
|
Buffer.byteLength(JSON.stringify(postTx)) <= 4096
|
|
73
73
|
) {
|
|
74
74
|
await view.put(op.key, op.value);
|
|
@@ -116,9 +116,7 @@ export class MainSettlementBus extends ReadyResource {
|
|
|
116
116
|
|
|
117
117
|
async updater(){
|
|
118
118
|
while(true){
|
|
119
|
-
|
|
120
|
-
await this.base.append(null);
|
|
121
|
-
}
|
|
119
|
+
await this.base.append(null);
|
|
122
120
|
await this.sleep(10_000);
|
|
123
121
|
}
|
|
124
122
|
}
|
|
@@ -156,12 +154,11 @@ export class MainSettlementBus extends ReadyResource {
|
|
|
156
154
|
|
|
157
155
|
if (sanitizeTransaction(parsedPreTx) &&
|
|
158
156
|
parsedPreTx.op === 'pre-tx' &&
|
|
159
|
-
crypto.verify(Buffer.from(parsedPreTx.tx
|
|
157
|
+
crypto.verify(Buffer.from(parsedPreTx.tx, 'utf-8'), Buffer.from(parsedPreTx.is, 'hex'), Buffer.from(parsedPreTx.ipk, 'hex')) &&
|
|
160
158
|
parsedPreTx.w === _this.writerLocalKey &&
|
|
161
159
|
null === await _this.base.view.get(parsedPreTx.tx)
|
|
162
160
|
) {
|
|
163
|
-
const
|
|
164
|
-
const signature = crypto.sign(Buffer.from(parsedPreTx.tx + nonce, 'utf-8'), Buffer.from(this.wallet.secretKey, 'hex'));
|
|
161
|
+
const signature = crypto.sign(Buffer.from(parsedPreTx.tx, 'utf-8'), Buffer.from(this.wallet.secretKey, 'hex'));
|
|
165
162
|
const append_tx = {
|
|
166
163
|
op: 'post-tx',
|
|
167
164
|
tx: parsedPreTx.tx,
|
|
@@ -172,7 +169,6 @@ export class MainSettlementBus extends ReadyResource {
|
|
|
172
169
|
ch: parsedPreTx.ch,
|
|
173
170
|
in: parsedPreTx.in,
|
|
174
171
|
ws: signature.toString('hex'),
|
|
175
|
-
wn : nonce,
|
|
176
172
|
wp: this.wallet.publicKey,
|
|
177
173
|
};
|
|
178
174
|
_this.tx_pool.push({ tx: parsedPreTx.tx, append_tx : append_tx });
|