@ethereumjs/devp2p / KBucketOptions
• Optional
arbiter: (incumbent
: Contact
, candidate
: Contact
) => Contact
▸ (incumbent
, candidate
): Contact
An optional arbiter function that given two contact
objects with the same id
,
returns the desired object to be used for updating the k-bucket.
Defaults to vectorClock arbiter function.
Name | Type |
---|---|
incumbent |
Contact |
candidate |
Contact |
packages/devp2p/src/types.ts:162
• Optional
distance: (firstId
: Uint8Array
, secondId
: Uint8Array
) => number
▸ (firstId
, secondId
): number
An optional distance function that gets two id Uint8Arrays and return distance between them as a number.
Name | Type |
---|---|
firstId |
Uint8Array |
secondId |
Uint8Array |
number
packages/devp2p/src/types.ts:156
• Optional
localNodeId: Uint8Array
An optional Uint8Array representing the local node id.
If not provided, a local node id will be created via randomBytes(20)
.
packages/devp2p/src/types.ts:141
• Optional
metadata: object
Optional satellite data to include
with the k-bucket. metadata
property is guaranteed not be altered by,
it is provided as an explicit container for users of k-bucket to store
implementation-specific data.
packages/devp2p/src/types.ts:169
• Optional
numberOfNodesPerKBucket: number
The number of nodes that a k-bucket can contain before being full or split. Defaults to 20.
packages/devp2p/src/types.ts:146
• Optional
numberOfNodesToPing: number
The number of nodes to ping when a bucket that should not be split becomes full.
KBucket will emit a ping
event that contains numberOfNodesToPing
nodes that have not been contacted the longest.
Defaults to 3.