Class: ConfirmStats

mempool~ConfirmStats(type, loggernullable)

Confirmation stats.

Constructor

new ConfirmStats(type, loggernullable)

Create confirmation stats.

Parameters:
Name Type Attributes Description
type String
logger Logger <nullable>
Source:

Methods

(static) fromRaw(data, type, loggernullable) → {ConfirmStats}

Instantiate confirm stats from serialized data.

Parameters:
Name Type Attributes Description
data Buffer
type String
logger Logger <nullable>
Source:
Returns:
Type
ConfirmStats

addTX(height, val) → {Number}

Add a transaction's rate/priority to be tracked.

Parameters:
Name Type Description
height Number

Block height.

val Number
Source:
Returns:

Bucket index.

Type
Number

clearCurrent(height)

Clear data for the current block.

Parameters:
Name Type Description
height Number
Source:

estimateMedian(target, needed, breakpoint, greater, height) → {Rate|Number}

Estimate the median value for rate or priority.

Parameters:
Name Type Description
target Number

Confirmation target.

needed Number

Sufficient tx value.

breakpoint Number

Success break point.

greater Boolean

Whether to look for lowest value.

height Number

Block height.

Source:
Returns:

Returns -1 on error.

Type
Rate | Number

(private) fromRaw(data) → {ConfirmStats}

Inject properties from serialized data.

Parameters:
Name Type Description
data Buffer
Source:
Returns:
Type
ConfirmStats

getSize() → {Number}

Get serialization size.

Source:
Returns:
Type
Number

(private) init(buckets, maxConfirms, decay)

Initialize stats.

Parameters:
Name Type Description
buckets Array
maxConfirms Number
decay Number
Source:

record(blocks, val)

Record a rate or priority based on number of blocks to confirm.

Parameters:
Name Type Description
blocks Number

Blocks to confirm.

val Rate | Number

Rate or priority.

Source:

removeTX(entryHeight, bestHeight, bucketIndex)

Remove a transaction from tracking.

Parameters:
Name Type Description
entryHeight Number
bestHeight Number
bucketIndex Number
Source:

toRaw() → {Buffer}

Serialize confirm stats.

Source:
Returns:
Type
Buffer

updateAverages()

Update moving averages.

Source: