trac-peer 0.1.82 → 0.1.84
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 +3 -3
- package/src/index.js +12 -0
- package/src/protocol.js +13 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "trac-peer",
|
|
3
3
|
"main": "src/index.js",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.84",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"assert": "npm:bare-node-assert",
|
|
@@ -59,8 +59,8 @@
|
|
|
59
59
|
"path": "npm:bare-node-path",
|
|
60
60
|
"pear-interface": "1.0.0",
|
|
61
61
|
"process": "npm:bare-node-process",
|
|
62
|
-
"protomux": "3.10.1",
|
|
63
|
-
"protomux-wakeup": "2.4.0",
|
|
62
|
+
"protomux": "^3.10.1",
|
|
63
|
+
"protomux-wakeup": "^2.4.0",
|
|
64
64
|
"readline": "npm:bare-node-readline",
|
|
65
65
|
"ready-resource": "1.1.2",
|
|
66
66
|
"repl": "npm:bare-node-repl",
|
package/src/index.js
CHANGED
|
@@ -99,6 +99,7 @@ export class Peer extends ReadyResource {
|
|
|
99
99
|
if(false === this.check.tx(op)) continue;
|
|
100
100
|
if(op.value.msbbs !== _this.msb.bootstrap) continue;
|
|
101
101
|
while (_this.msb.base.view.core.signedLength < op.value.msbsl) {
|
|
102
|
+
console.log(_this.msb.base.view.core.signedLength, '<', op.value.msbsl)
|
|
102
103
|
await new Promise( (resolve, reject) => {
|
|
103
104
|
_this.msb.base.view.core.once('append', resolve);
|
|
104
105
|
});
|
|
@@ -644,6 +645,17 @@ export class Peer extends ReadyResource {
|
|
|
644
645
|
const msb_tx = await view_session.get(tx);
|
|
645
646
|
await view_session.close();
|
|
646
647
|
if(null !== msb_tx){
|
|
648
|
+
const _this = this;
|
|
649
|
+
async function push(){
|
|
650
|
+
await _this.sleep(5_000);
|
|
651
|
+
try{
|
|
652
|
+
await _this.protocol_instance.broadcastTransaction(_this.msb.getNetwork().validator,{
|
|
653
|
+
type : 'p',
|
|
654
|
+
value : ''
|
|
655
|
+
});
|
|
656
|
+
} catch(e) { }
|
|
657
|
+
}
|
|
658
|
+
push();
|
|
647
659
|
const _tx = {};
|
|
648
660
|
_tx['msbsl'] = msbsl;
|
|
649
661
|
_tx['dispatch'] = this.protocol_instance.prepared_transactions_content[tx].dispatch;
|
package/src/protocol.js
CHANGED
|
@@ -193,10 +193,22 @@ class Protocol{
|
|
|
193
193
|
if(this.peer.msb.getNetwork().validator_stream === null) throw new Error('HyperMallProtocol::tx(): No validator available.');
|
|
194
194
|
const obj = this.mapTxCommand(subject.command);
|
|
195
195
|
if(null !== obj && typeof obj.type === 'string' && obj.value !== undefined) {
|
|
196
|
-
|
|
196
|
+
const ret = await this.broadcastTransaction(this.peer.msb.getNetwork().validator,{
|
|
197
197
|
type : obj.type,
|
|
198
198
|
value : obj.value
|
|
199
199
|
}, sim, surrogate);
|
|
200
|
+
const _this = this;
|
|
201
|
+
async function push(){
|
|
202
|
+
await _this.peer.sleep(5_000);
|
|
203
|
+
try{
|
|
204
|
+
await _this.broadcastTransaction(_this.peer.msb.getNetwork().validator,{
|
|
205
|
+
type : 'p',
|
|
206
|
+
value : ''
|
|
207
|
+
});
|
|
208
|
+
} catch(e) { }
|
|
209
|
+
}
|
|
210
|
+
push();
|
|
211
|
+
return ret;
|
|
200
212
|
}
|
|
201
213
|
throw new Error('HyperMallProtocol::tx(): command not found.');
|
|
202
214
|
}
|