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

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

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:

(private) read(data) → {ConfirmStats}

Inject properties from serialized data.

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

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:

updateAverages()

Update moving averages.

Source:

write() → {Buffer}

Serialize confirm stats.

Source:
Returns:
Type
Buffer