@@ -17,7 +17,7 @@ import PeerId = require('peer-id')
17
17
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
18
18
// @ts -ignore
19
19
import Envelope = require( 'libp2p/src/record/envelope' )
20
- import { ACCEPT_FROM_WHITE_LIST_DURATION_MS , ACCEPT_FROM_WHITE_LIST_MAX_MESSAGES , ACCEPT_FROM_WHITE_LIST_THRESHOLD_SCORE } from './constants'
20
+ import { ACCEPT_FROM_WHITELIST_DURATION_MS , ACCEPT_FROM_WHITELIST_MAX_MESSAGES , ACCEPT_FROM_WHITELIST_THRESHOLD_SCORE } from './constants'
21
21
22
22
interface GossipInputOptions {
23
23
emitSelf : boolean
@@ -85,7 +85,7 @@ interface GossipOptions extends GossipInputOptions {
85
85
scoreThresholds : PeerScoreThresholds
86
86
}
87
87
88
- interface AcceptFromWhiteListEntry {
88
+ interface AcceptFromWhitelistEntry {
89
89
/** number of messages accepted since recomputing the peer's score */
90
90
messagesAccepted : number
91
91
/** have to recompute score after this time */
@@ -96,7 +96,7 @@ class Gossipsub extends Pubsub {
96
96
peers : Map < string , PeerStreams >
97
97
direct : Set < string >
98
98
seenCache : SimpleTimeCache
99
- acceptFromWhitelist : Map < string , AcceptFromWhiteListEntry >
99
+ acceptFromWhitelist : Map < string , AcceptFromWhitelistEntry >
100
100
topics : Map < string , Set < string > >
101
101
mesh : Map < string , Set < string > >
102
102
fanout : Map < string , Set < string > >
@@ -194,7 +194,7 @@ class Gossipsub extends Pubsub {
194
194
/**
195
195
* Map of peer id and AcceptRequestWhileListEntry
196
196
*
197
- * @type {Map<string, AcceptFromWhiteListEntry }
197
+ * @type {Map<string, AcceptFromWhitelistEntry }
198
198
*/
199
199
this . acceptFromWhitelist = new Map ( )
200
200
@@ -475,19 +475,19 @@ class Gossipsub extends Pubsub {
475
475
const entry = this . acceptFromWhitelist . get ( id )
476
476
477
477
if ( entry &&
478
- entry . messagesAccepted < ACCEPT_FROM_WHITE_LIST_MAX_MESSAGES &&
478
+ entry . messagesAccepted < ACCEPT_FROM_WHITELIST_MAX_MESSAGES &&
479
479
entry . acceptUntil >= now ) {
480
480
entry . messagesAccepted += 1
481
481
return true
482
482
}
483
483
484
484
const score = this . score . score ( id )
485
- if ( score >= ACCEPT_FROM_WHITE_LIST_THRESHOLD_SCORE ) {
485
+ if ( score >= ACCEPT_FROM_WHITELIST_THRESHOLD_SCORE ) {
486
486
// peer is unlikely to be able to drop its score to `graylistThreshold`
487
487
// after 128 messages or 1s
488
488
this . acceptFromWhitelist . set ( id , {
489
489
messagesAccepted : 0 ,
490
- acceptUntil : now + ACCEPT_FROM_WHITE_LIST_DURATION_MS
490
+ acceptUntil : now + ACCEPT_FROM_WHITELIST_DURATION_MS
491
491
} )
492
492
} else {
493
493
this . acceptFromWhitelist . delete ( id )
0 commit comments