Home Reference Source Test
public class | source

BaseConsensus

Extends:

Observable → BaseConsensus

Constructor Summary

Public Constructor
public

constructor(blockchain: BaseChain, mempool: Observable, network: Network)

Member Summary

Public Members
public get

established: boolean

public get
public get

Method Summary

Public Methods
public

subscribe(subscription: Subscription)

Protected Methods
protected
protected
protected
protected

_onPeerLeft(peer: Peer)

protected
protected
protected
protected
protected

async _requestBlockProof(blockHashToProve: Hash, blockHeightToProve: number): Promise<Block>

protected

async _requestTransactionHistory(address: Address): Promise<Array<{transaction: Transaction, header: BlockHeader}>>

protected

async _requestTransactionReceipts(address: Address): Promise<Array<TransactionReceipt>>

protected

async _requestTransactionsProof(addresses: Array<Address>, block: Block): Promise<Array<Transaction>>

protected

Inherited Summary

From class Observable
public static get

WILDCARD: string: string

public

bubble(observable: Observable, types: ...string)

public

fire(type: string, args: ...*): Promise | null

public

off(type: string, id: number)

public

on(type: string, callback: Function): number

Public Constructors

public constructor(blockchain: BaseChain, mempool: Observable, network: Network) source

Override:

Observable#constructor

Params:

NameTypeAttributeDescription
blockchain BaseChain
mempool Observable
network Network

Public Members

public get established: boolean source

public get invRequestManager: InvRequestManager source

public get network: Network source

Public Methods

public subscribe(subscription: Subscription) source

Params:

NameTypeAttributeDescription
subscription Subscription

Protected Methods

protected _newConsensusAgent(peer: Peer): BaseConsensusAgent source

Params:

NameTypeAttributeDescription
peer Peer

protected _onHeadChanged(head: Block) source

Params:

NameTypeAttributeDescription
head Block

protected _onPeerJoined(peer: Peer): BaseConsensusAgent source

Params:

NameTypeAttributeDescription
peer Peer

protected _onPeerLeft(peer: Peer) source

Params:

NameTypeAttributeDescription
peer Peer

protected _onPeerOutOfSync(peer: Peer) source

Params:

NameTypeAttributeDescription
peer Peer

protected _onPeerSynced(peer: Peer) source

Params:

NameTypeAttributeDescription
peer Peer

protected _onTransactionAdded(tx: Transaction) source

Params:

NameTypeAttributeDescription
tx Transaction

protected _onTransactionRemoved(tx: Transaction) source

Params:

NameTypeAttributeDescription
tx Transaction

protected async _requestBlockProof(blockHashToProve: Hash, blockHeightToProve: number): Promise<Block> source

Params:

NameTypeAttributeDescription
blockHashToProve Hash
blockHeightToProve number

Return:

Promise<Block>

protected async _requestTransactionHistory(address: Address): Promise<Array<{transaction: Transaction, header: BlockHeader}>> source

Params:

NameTypeAttributeDescription
address Address

Return:

Promise<Array<{transaction: Transaction, header: BlockHeader}>>

protected async _requestTransactionReceipts(address: Address): Promise<Array<TransactionReceipt>> source

Params:

NameTypeAttributeDescription
address Address

Return:

Promise<Array<TransactionReceipt>>

protected async _requestTransactionsProof(addresses: Array<Address>, block: Block): Promise<Array<Transaction>> source

Params:

NameTypeAttributeDescription
addresses Array<Address>
block Block
  • optional

Return:

Promise<Array<Transaction>>

protected _syncBlockchain() source