trac-peer 0.1.88 → 0.1.90
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 +17 -16
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -59,6 +59,7 @@ export class Peer extends ReadyResource {
|
|
|
59
59
|
this.dhtBootstrap = ['116.202.214.149:10001', '157.180.12.214:10001', 'node1.hyperdht.org:49737', 'node2.hyperdht.org:49737', 'node3.hyperdht.org:49737'];
|
|
60
60
|
this.readline_instance = null;
|
|
61
61
|
this.enable_interactive_mode = options.enable_interactive_mode !== false;
|
|
62
|
+
this.enable_txlogs = true === options.enable_txlogs;
|
|
62
63
|
if(this.enable_interactive_mode !== false){
|
|
63
64
|
try{
|
|
64
65
|
this.readline_instance = readline.createInterface({
|
|
@@ -155,7 +156,9 @@ export class Peer extends ReadyResource {
|
|
|
155
156
|
}
|
|
156
157
|
await batch.put('utxi/'+post_tx.value.ipk+'/'+ulen, len);
|
|
157
158
|
await batch.put('utxl/'+post_tx.value.ipk, ulen + 1);
|
|
158
|
-
|
|
159
|
+
if(true === _this.enable_txlogs){
|
|
160
|
+
console.log(`${post_tx.value.tx} appended. Signed length:`, _this.base.view.core.signedLength, 'tx length', len + 1);
|
|
161
|
+
}
|
|
159
162
|
}
|
|
160
163
|
} else if(op.type === 'msg') {
|
|
161
164
|
if(b4a.byteLength(jsonStringify(op)) > _this.protocol_instance.msgMaxBytes()) continue;
|
|
@@ -646,22 +649,20 @@ export class Peer extends ReadyResource {
|
|
|
646
649
|
const msb_tx = await view_session.get(tx);
|
|
647
650
|
await view_session.close();
|
|
648
651
|
if(null !== msb_tx){
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
} catch(e) { console.log(e) }
|
|
652
|
+
if(this.protocol_instance.prepared_transactions_content[tx].dispatch.type !== undefined &&
|
|
653
|
+
this.protocol_instance.prepared_transactions_content[tx].dispatch.type !== 'p'){
|
|
654
|
+
const _this = this;
|
|
655
|
+
async function push(){
|
|
656
|
+
await _this.sleep(10_000 + (backoff * 250));
|
|
657
|
+
try{
|
|
658
|
+
await _this.protocol_instance.broadcastTransaction(_this.msb.getNetwork().validator,{
|
|
659
|
+
type : 'p',
|
|
660
|
+
value : ''
|
|
661
|
+
});
|
|
662
|
+
} catch(e) { }
|
|
663
|
+
}
|
|
664
|
+
push();
|
|
663
665
|
}
|
|
664
|
-
push();
|
|
665
666
|
const _tx = {};
|
|
666
667
|
_tx['msbsl'] = msbsl;
|
|
667
668
|
_tx['dispatch'] = this.protocol_instance.prepared_transactions_content[tx].dispatch;
|