trac-msb 0.0.47 → 0.0.48
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 +12 -1
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -65,10 +65,11 @@ export class MainSettlementBus extends ReadyResource {
|
|
|
65
65
|
const postTx = op.value;
|
|
66
66
|
if (op.type === 'tx') {
|
|
67
67
|
if (null === await view.get(op.key) &&
|
|
68
|
-
sanitizeTransaction(postTx) &&
|
|
69
68
|
postTx.op === 'post-tx' &&
|
|
69
|
+
sanitizeTransaction(postTx) &&
|
|
70
70
|
hccrypto.verify(b4a.from(postTx.tx + postTx.in, 'utf-8'), b4a.from(postTx.is, 'hex'), b4a.from(postTx.ipk, 'hex')) &&
|
|
71
71
|
hccrypto.verify(b4a.from(postTx.tx + postTx.wn, 'utf-8'), b4a.from(postTx.ws, 'hex'), b4a.from(postTx.wp, 'hex')) &&
|
|
72
|
+
postTx.tx === await _this.generateTx(postTx.bs, postTx.w, postTx.i, postTx.ipk, postTx.ch, postTx.in) &&
|
|
72
73
|
b4a.byteLength(JSON.stringify(postTx)) <= 4096
|
|
73
74
|
) {
|
|
74
75
|
await view.put(op.key, op.value);
|
|
@@ -277,6 +278,16 @@ export class MainSettlementBus extends ReadyResource {
|
|
|
277
278
|
}
|
|
278
279
|
}
|
|
279
280
|
|
|
281
|
+
async generateTx(bootstrap, validator_writer_key, local_writer_key, local_public_key, content_hash, nonce){
|
|
282
|
+
let tx = bootstrap + '-' +
|
|
283
|
+
validator_writer_key + '-' +
|
|
284
|
+
local_writer_key + '-' +
|
|
285
|
+
local_public_key + '-' +
|
|
286
|
+
content_hash + '-' +
|
|
287
|
+
nonce;
|
|
288
|
+
return await this.peer.createHash('sha256', await this.peer.createHash('sha256', tx));
|
|
289
|
+
}
|
|
290
|
+
|
|
280
291
|
async verifyDag() {
|
|
281
292
|
try {
|
|
282
293
|
console.log('--- DAG Monitoring ---');
|