Home Reference Source
public class | source

InterfaceBlockchainProtocolForkSolver

Blockchain Protocol Fork Solver - that solves the fork of a new blockchain

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public
public

Method Summary

Public Methods
public

async discoverFork(socket: *, forkChainLength: *, forkChainStartingPoint: *, forkLastBlockHash: *, forkProof: *, forkChainWork: *): {"result": *, "error": *}

public

async optionalProcess(socket: *, binarySearchResult: *, currentBlockchainLength: *, forkChainLength: *, forkChainStartingPoint: *)

Private Methods
private

async _calculateForkBinarySearch(socket: *, forkChainStartingPoint: *, forkChainLength: *, currentBlockchainLength: *): *

private

_deserializeForkBlock(fork: *, blockData: *, blockHeight: *, validationBlock: *): *

private

async _discoverForkBinarySearch(socket: *, initialLeft: *, left: *, right: *): {"position": *, "header": *}

private

async _solveFork(fork: *): Promise<boolean>

Solve Fork by Downloading the blocks required in the fork

Public Constructors

public constructor() source

Public Members

public blockchain: * source

public protocol: * source

Public Methods

public async discoverFork(socket: *, forkChainLength: *, forkChainStartingPoint: *, forkLastBlockHash: *, forkProof: *, forkChainWork: *): {"result": *, "error": *} source

Params:

NameTypeAttributeDescription
socket *
forkChainLength *
forkChainStartingPoint *
forkLastBlockHash *
forkProof *
forkChainWork *

Return:

{"result": *, "error": *}

public async optionalProcess(socket: *, binarySearchResult: *, currentBlockchainLength: *, forkChainLength: *, forkChainStartingPoint: *) source

Params:

NameTypeAttributeDescription
socket *
binarySearchResult *
currentBlockchainLength *
forkChainLength *
forkChainStartingPoint *

Private Methods

private async _calculateForkBinarySearch(socket: *, forkChainStartingPoint: *, forkChainLength: *, currentBlockchainLength: *): * source

Params:

NameTypeAttributeDescription
socket *
forkChainStartingPoint *
forkChainLength *
currentBlockchainLength *

Return:

*

private _deserializeForkBlock(fork: *, blockData: *, blockHeight: *, validationBlock: *): * source

Params:

NameTypeAttributeDescription
fork *
blockData *
blockHeight *
validationBlock *

Return:

*

private async _discoverForkBinarySearch(socket: *, initialLeft: *, left: *, right: *): {"position": *, "header": *} source

Params:

NameTypeAttributeDescription
socket *
initialLeft *
left *
right *

Return:

{"position": *, "header": *}

private async _solveFork(fork: *): Promise<boolean> source

Solve Fork by Downloading the blocks required in the fork

Params:

NameTypeAttributeDescription
fork *

Return:

Promise<boolean>