trac-peer 0.0.92 → 0.0.94

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "trac-peer",
3
3
  "main": "src/index.js",
4
- "version": "0.0.92",
4
+ "version": "0.0.94",
5
5
  "type": "module",
6
6
  "dependencies": {
7
7
  "trac-wallet": "^0.0.34",
package/src/index.js CHANGED
@@ -86,13 +86,14 @@ export class Peer extends ReadyResource {
86
86
  await msb_view_session.close();
87
87
  if(false === this.check.postTx(post_tx)) continue;
88
88
  if (null === await batch.get('tx/'+op.key) &&
89
+ op.key === post_tx.value.tx &&
89
90
  _this.wallet.verify(post_tx.value.ws, post_tx.value.tx + post_tx.value.wn, post_tx.value.wp) &&
90
- _this.wallet.verify(post_tx.value.is, post_tx.value.tx + post_tx.value.n, post_tx.value.ipk) &&
91
+ _this.wallet.verify(post_tx.value.is, post_tx.value.tx + post_tx.value.in, post_tx.value.ipk) &&
91
92
  post_tx.value.tx === await _this.protocol_instance.generateTx(
92
- _this.bootstrap,
93
- post_tx.value.w, post_tx.value.i, op.value.ipk,
94
- op.value.dispatch, post_tx.value.in
95
- ) &&
93
+ _this.bootstrap, _this.msb.bootstrap,
94
+ post_tx.value.w, post_tx.value.i, op.value.ipk,
95
+ op.value.dispatch, post_tx.value.in
96
+ ) &&
96
97
  false !== await _this.contract_instance.execute(op, node, batch)) {
97
98
  let len = await batch.get('txl');
98
99
  if(null === len) {
package/src/protocol.js CHANGED
@@ -70,9 +70,10 @@ class Protocol{
70
70
  this.features[key] = feature;
71
71
  }
72
72
 
73
- async generateTx(bootstrap, validator_writer_key, local_writer_key, local_public_key, content, nonce){
73
+ async generateTx(bootstrap, msb_bootstrap, validator_writer_key, local_writer_key, local_public_key, content, nonce){
74
74
  const content_hash = await this.peer.createHash('sha256', jsonStringify(content));
75
75
  let tx = bootstrap + '-' +
76
+ msb_bootstrap + '-' +
76
77
  validator_writer_key + '-' +
77
78
  local_writer_key + '-' +
78
79
  local_public_key + '-' +
@@ -89,7 +90,7 @@ class Protocol{
89
90
  {
90
91
  this.nonce = Math.random() + '-' + Date.now();
91
92
  const content_hash = await this.peer.createHash('sha256', JSON.stringify(obj));
92
- let tx = await this.generateTx(this.peer.bootstrap, validator_writer_key, this.peer.writerLocalKey, this.peer.wallet.publicKey, obj, this.nonce);
93
+ let tx = await this.generateTx(this.peer.bootstrap, this.peer.msb.bootstrap, validator_writer_key, this.peer.writerLocalKey, this.peer.wallet.publicKey, obj, this.nonce);
93
94
  const signature = this.peer.wallet.sign(tx + this.nonce);
94
95
  this.peer.emit('tx', {
95
96
  op: 'pre-tx',
@@ -100,7 +101,8 @@ class Protocol{
100
101
  ipk: this.peer.wallet.publicKey,
101
102
  ch : content_hash,
102
103
  in : this.nonce,
103
- bs : this.peer.bootstrap
104
+ bs : this.peer.bootstrap,
105
+ mbs : this.peer.msb.bootstrap
104
106
  });
105
107
  this.prepared_transactions_content[tx] = obj;
106
108
  } else {