Home Reference Source
public class | source

PoolData

Static Method Summary

Static Public Methods
public static

compareMiners(miner1: *, miner2: *): boolean

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public

blocksInfo: *[]

public get
public
public get
public

miners: *[]

public
Private Members
private

_db: *

Method Summary

Public Methods
public
public

addMiner(minerAddress: *, minerReward: *): *

Insert a new miner if not exists.

public
public

findBlockInformation(blockInformation: *, returnPos: boolean): *

public

findMiner(minerAddress: *, returnPos: boolean): *

public

getMinerInstance(minerAddress: *): *

public

async initializePoolData(): *

public

async removeMiner(minerAddress: *): *

Remove a miner if exists.

public

Save miners to database

public

Save miners to database

public
Private Methods
private
private

_compareMinersList(minersList: *): boolean

private

async _deserializeBlockInformation(buffer: *, offset: number): boolean

private

_deserializeMiners(buffer: *, offset: number): boolean

private
private

Load miners from database

private

async _loadPoolData(): *

private

async _savePoolData(): *

private
private

async _serializeMiners(): *

Static Public Methods

public static compareMiners(miner1: *, miner2: *): boolean source

Params:

NameTypeAttributeDescription
miner1 *
miner2 *

Return:

boolean

true if miners are equal

Public Constructors

public constructor() source

Public Members

public blocksInfo: *[] source

public get confirmedBlockInformations: * source

public connectedMinerInstances: * source

public get lastBlockInformation: * source

public miners: *[] source

public poolManagement: * source

Private Members

private _db: * source

Public Methods

public addBlockInformation(): * source

Return:

*

public addMiner(minerAddress: *, minerReward: *): * source

Insert a new miner if not exists. Synchronizes with DB.

Params:

NameTypeAttributeDescription
minerAddress *
minerReward *

Return:

*

true/false

public deleteBlockInformation(index: *): boolean source

Params:

NameTypeAttributeDescription
index *

Return:

boolean

public findBlockInformation(blockInformation: *, returnPos: boolean): * source

Params:

NameTypeAttributeDescription
blockInformation *
returnPos boolean
  • optional
  • default: false

Return:

*

public findMiner(minerAddress: *, returnPos: boolean): * source

Params:

NameTypeAttributeDescription
minerAddress *
returnPos boolean
  • optional
  • default: false

Return:

*

public getMinerInstance(minerAddress: *): * source

Params:

NameTypeAttributeDescription
minerAddress *

Return:

*

miner or null if it doesn't exist

public async initializePoolData(): * source

Return:

*

public async removeMiner(minerAddress: *): * source

Remove a miner if exists. Synchronizes with DB.

Params:

NameTypeAttributeDescription
minerAddress *

Return:

*

true/false

public async saveBlocksInformation(): boolean source

Save miners to database

Return:

boolean

true is success, otherwise false

public async saveMinersList(): boolean source

Save miners to database

Return:

boolean

true is success, otherwise false

public updateRewards(): boolean source

Return:

boolean

Private Methods

private _clearEmptyMiners() source

private _compareMinersList(minersList: *): boolean source

Params:

NameTypeAttributeDescription
minersList *

Return:

boolean

true if this.miners === minersList

private async _deserializeBlockInformation(buffer: *, offset: number): boolean source

Params:

NameTypeAttributeDescription
buffer *
offset number
  • optional
  • default: 0

Return:

boolean

private _deserializeMiners(buffer: *, offset: number): boolean source

Params:

NameTypeAttributeDescription
buffer *
offset number
  • optional
  • default: 0

Return:

boolean

private async _loadBlockInformations(): boolean source

Return:

boolean

private async _loadMinersList(): boolean source

Load miners from database

Return:

boolean

true is success, otherwise false

private async _loadPoolData(): * source

Return:

*

private async _savePoolData(): * source

Return:

*

private _serializeBlockInformation(): * source

Return:

*

private async _serializeMiners(): * source

Return:

*