File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -13,14 +13,14 @@ export class BanList {
13
13
this . lru = new LRUCache ( { max : 30000 } ) // 10k should be enough (each peer obj can has 3 keys)
14
14
}
15
15
16
- add ( obj : string | Buffer | PeerInfo , maxAge ?: number ) {
16
+ add ( obj : string | Buffer | PeerInfo , maxAge ?: number ) {
17
17
for ( const key of KBucket . getKeys ( obj ) ) {
18
18
this . lru . set ( key , true , maxAge )
19
19
debug ( `Added peer ${ formatLogId ( key , verbose ) } , size: ${ this . lru . length } ` )
20
20
}
21
21
}
22
22
23
- has ( obj : string | Buffer | PeerInfo ) : boolean {
23
+ has ( obj : string | Buffer | PeerInfo ) : boolean {
24
24
return KBucket . getKeys ( obj ) . some ( ( key : string ) => Boolean ( this . lru . get ( key ) ) )
25
25
}
26
26
}
Original file line number Diff line number Diff line change @@ -182,8 +182,8 @@ export class ETH extends EventEmitter {
182
182
verbose
183
183
) } `
184
184
if ( this . _version >= 64 ) {
185
- sStr += `, ForkHash: 0x${ ( status [ 5 ] [ 0 ] as Buffer ) . toString ( 'hex' ) } `
186
- sStr += `, ForkNext: ${ buffer2int ( status [ 5 ] [ 1 ] as Buffer ) } `
185
+ sStr += `, ForkHash: 0x${ status [ 5 ] ? '0x' + ( status [ 5 ] [ 0 ] as Buffer ) . toString ( 'hex' ) : '-' } `
186
+ sStr += `, ForkNext: ${ status [ 5 ] ? buffer2int ( status [ 5 ] [ 1 ] as Buffer ) : '-' } `
187
187
}
188
188
sStr += `]`
189
189
return sStr
You can’t perform that action at this time.
0 commit comments