trac-peer 0.1.84 → 0.1.86
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 +15 -10
- package/src/protocol.js +1 -1
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -632,6 +632,7 @@ export class Peer extends ReadyResource {
|
|
|
632
632
|
|
|
633
633
|
async tx_observer(){
|
|
634
634
|
while(true){
|
|
635
|
+
let backoff = 1;
|
|
635
636
|
const ts = Math.floor(Date.now() / 1000);
|
|
636
637
|
for(let tx in this.tx_pool){
|
|
637
638
|
if(ts - this.tx_pool[tx].ts > this.max_tx_delay){
|
|
@@ -645,17 +646,20 @@ export class Peer extends ReadyResource {
|
|
|
645
646
|
const msb_tx = await view_session.get(tx);
|
|
646
647
|
await view_session.close();
|
|
647
648
|
if(null !== msb_tx){
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
await _this.
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
649
|
+
if(this.protocol_instance.prepared_transactions_content[tx].dispatch.type !== undefined &&
|
|
650
|
+
this.protocol_instance.prepared_transactions_content[tx].dispatch.type !== 'p'){
|
|
651
|
+
const _this = this;
|
|
652
|
+
async function push(){
|
|
653
|
+
await _this.sleep(10_000 + (backoff * 250));
|
|
654
|
+
try{
|
|
655
|
+
await _this.protocol_instance.broadcastTransaction(_this.msb.getNetwork().validator,{
|
|
656
|
+
type : 'p',
|
|
657
|
+
value : ''
|
|
658
|
+
});
|
|
659
|
+
} catch(e) { }
|
|
660
|
+
}
|
|
661
|
+
push();
|
|
657
662
|
}
|
|
658
|
-
push();
|
|
659
663
|
const _tx = {};
|
|
660
664
|
_tx['msbsl'] = msbsl;
|
|
661
665
|
_tx['dispatch'] = this.protocol_instance.prepared_transactions_content[tx].dispatch;
|
|
@@ -665,6 +669,7 @@ export class Peer extends ReadyResource {
|
|
|
665
669
|
delete this.tx_pool[tx];
|
|
666
670
|
delete this.protocol_instance.prepared_transactions_content[tx];
|
|
667
671
|
await this.base.append({ type: 'tx', key: tx, value: _tx });
|
|
672
|
+
backoff += 1;
|
|
668
673
|
}
|
|
669
674
|
await this.sleep(5);
|
|
670
675
|
}
|
package/src/protocol.js
CHANGED
|
@@ -199,7 +199,7 @@ class Protocol{
|
|
|
199
199
|
}, sim, surrogate);
|
|
200
200
|
const _this = this;
|
|
201
201
|
async function push(){
|
|
202
|
-
await _this.peer.sleep(
|
|
202
|
+
await _this.peer.sleep(10_000);
|
|
203
203
|
try{
|
|
204
204
|
await _this.broadcastTransaction(_this.peer.msb.getNetwork().validator,{
|
|
205
205
|
type : 'p',
|