trac-msb 0.0.46 → 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/msb.mjs +1 -1
- package/package.json +1 -1
- package/src/index.js +15 -3
package/msb.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import MainSettlementBus from './src/index.js';
|
|
|
3
3
|
const opts = {
|
|
4
4
|
stores_directory : 'stores/',
|
|
5
5
|
store_name : typeof process !== "undefined" ? process.argv[2] : Pear.config.args[0],
|
|
6
|
-
bootstrap: '
|
|
6
|
+
bootstrap: '28e0189443903bd066fbddb1276aafd57177340696349534de2b5448eb8b871f',
|
|
7
7
|
channel: '00bptracnetworkmainsettlementbus',
|
|
8
8
|
tx : 'bptracnetworkmainsettlementbustx'
|
|
9
9
|
};
|
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' &&
|
|
70
|
-
|
|
71
|
-
hccrypto.verify(b4a.from(postTx.tx + postTx.
|
|
69
|
+
sanitizeTransaction(postTx) &&
|
|
70
|
+
hccrypto.verify(b4a.from(postTx.tx + postTx.in, 'utf-8'), b4a.from(postTx.is, 'hex'), b4a.from(postTx.ipk, 'hex')) &&
|
|
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);
|
|
@@ -171,6 +172,7 @@ export class MainSettlementBus extends ReadyResource {
|
|
|
171
172
|
ipk: parsedPreTx.ipk,
|
|
172
173
|
ch: parsedPreTx.ch,
|
|
173
174
|
in: parsedPreTx.in,
|
|
175
|
+
bs: parsedPreTx.bs,
|
|
174
176
|
ws: signature.toString('hex'),
|
|
175
177
|
wp: this.wallet.publicKey,
|
|
176
178
|
wn : nonce
|
|
@@ -276,6 +278,16 @@ export class MainSettlementBus extends ReadyResource {
|
|
|
276
278
|
}
|
|
277
279
|
}
|
|
278
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
|
+
|
|
279
291
|
async verifyDag() {
|
|
280
292
|
try {
|
|
281
293
|
console.log('--- DAG Monitoring ---');
|