trac-peer 0.1.83 → 0.1.85
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 +3 -1
- package/src/protocol.js +2 -2
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){
|
|
@@ -647,7 +648,7 @@ export class Peer extends ReadyResource {
|
|
|
647
648
|
if(null !== msb_tx){
|
|
648
649
|
const _this = this;
|
|
649
650
|
async function push(){
|
|
650
|
-
await _this.sleep(
|
|
651
|
+
await _this.sleep(10_000 * (backoff * 100));
|
|
651
652
|
try{
|
|
652
653
|
await _this.protocol_instance.broadcastTransaction(_this.msb.getNetwork().validator,{
|
|
653
654
|
type : 'p',
|
|
@@ -665,6 +666,7 @@ export class Peer extends ReadyResource {
|
|
|
665
666
|
delete this.tx_pool[tx];
|
|
666
667
|
delete this.protocol_instance.prepared_transactions_content[tx];
|
|
667
668
|
await this.base.append({ type: 'tx', key: tx, value: _tx });
|
|
669
|
+
backoff += 1;
|
|
668
670
|
}
|
|
669
671
|
await this.sleep(5);
|
|
670
672
|
}
|
package/src/protocol.js
CHANGED
|
@@ -199,9 +199,9 @@ 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
|
-
await _this.broadcastTransaction(
|
|
204
|
+
await _this.broadcastTransaction(_this.peer.msb.getNetwork().validator,{
|
|
205
205
|
type : 'p',
|
|
206
206
|
value : ''
|
|
207
207
|
});
|