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 +1 -1
- package/src/index.js +6 -5
- package/src/protocol.js +5 -3
package/package.json
CHANGED
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.
|
|
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
|
-
|
|
93
|
-
|
|
94
|
-
|
|
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 {
|