hypercore 11.11.2 → 11.12.0
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/lib/replicator.js +10 -2
- package/package.json +1 -1
package/lib/replicator.js
CHANGED
|
@@ -402,7 +402,9 @@ class Peer {
|
|
|
402
402
|
wireBitfield: { tx: 0, rx: 0 },
|
|
403
403
|
wireRange: { tx: 0, rx: 0 },
|
|
404
404
|
wireExtension: { tx: 0, rx: 0 },
|
|
405
|
-
hotswaps: 0
|
|
405
|
+
hotswaps: 0,
|
|
406
|
+
invalidData: 0,
|
|
407
|
+
invalidRequests: 0
|
|
406
408
|
}
|
|
407
409
|
|
|
408
410
|
this.receiverQueue = new ReceiverQueue()
|
|
@@ -725,6 +727,8 @@ class Peer {
|
|
|
725
727
|
return new ProofRequest(msg, proof, block, manifest)
|
|
726
728
|
} catch (err) {
|
|
727
729
|
batch.destroy()
|
|
730
|
+
this.stats.invalidRequests++
|
|
731
|
+
this.replicator.stats.invalidRequests++
|
|
728
732
|
throw err
|
|
729
733
|
}
|
|
730
734
|
}
|
|
@@ -1496,7 +1500,9 @@ module.exports = class Replicator {
|
|
|
1496
1500
|
wireBitfield: { tx: 0, rx: 0 },
|
|
1497
1501
|
wireRange: { tx: 0, rx: 0 },
|
|
1498
1502
|
wireExtension: { tx: 0, rx: 0 },
|
|
1499
|
-
hotswaps: 0
|
|
1503
|
+
hotswaps: 0,
|
|
1504
|
+
invalidData: 0,
|
|
1505
|
+
invalidRequests: 0
|
|
1500
1506
|
}
|
|
1501
1507
|
|
|
1502
1508
|
this._attached = new Set()
|
|
@@ -2541,6 +2547,8 @@ module.exports = class Replicator {
|
|
|
2541
2547
|
_oninvalid (err, req, res, from) {
|
|
2542
2548
|
const sessions = this.core.monitors
|
|
2543
2549
|
|
|
2550
|
+
this.stats.invalidData++
|
|
2551
|
+
from.stats.invalidData++
|
|
2544
2552
|
for (let i = 0; i < sessions.length; i++) {
|
|
2545
2553
|
sessions[i].emit('verification-error', err, req, res, from)
|
|
2546
2554
|
}
|