Home Reference Source Test
public class | source

NanoConsensusAgent

Extends:

ObservableBaseConsensusAgent → NanoConsensusAgent

Constructor Summary

Public Constructor
public

constructor(blockchain: NanoChain, mempool: NanoMempool, time: Time, peer: Peer, invRequestManager: InvRequestManager, targetSubscription: Subscription)

Member Summary

Public Members
public get

syncing: boolean

Method Summary

Public Methods
public

getAccounts(blockHash: Hash, addresses: Array<Address>): Promise<Array<Account>>

public
public

async syncBlockchain(): Promise<void>

Protected Methods
protected

_doRequestData(vectors: Array<InvVector>): void

protected

_getBlock(hash: Hash, includeForks: boolean): PromiseBlock>

protected
protected

_onClose(): void

protected

async _processHeader(hash: Hash, header: BlockHeader): Promise<void>

protected

_processTransaction(hash: Hash, transaction: Transaction): Promise<void>

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

From class BaseConsensusAgent
public get
public get

synced: boolean

public get

syncing: boolean

public

getBlockProof(blockHashToProve: Hash, knownBlock: Block): Promise<Block>

public
public

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

public

knowsBlock(blockHash: Hash): boolean

public
public

relayBlock(block: Block): boolean

public

relayTransaction(transaction: Transaction): boolean

public
public
public

subscribe(subscription: Subscription)

protected

async __onInv(msg: InvMessage): Promise<void>

protected

_doRequestData(vectors: Array<InvVector>): void

protected abstract

_getBlock(hash: Hash, includeForks: boolean, includeBody: boolean): PromiseBlock>

protected abstract

_getRawBlock(hash: Hash, includeForks: boolean): PromiseUint8Array>

protected abstract
protected

_noMoreData(): void

protected
protected
protected

async _onBlock(msg: BlockMessage): Promise<void>

protected

_onClose(): void

protected

async _onGetData(msg: GetDataMessage): Promise<void>

protected

async _onGetHeader(msg: GetHeaderMessage): Promise

protected

async _onHeader(msg: HeaderMessage): Promise<void>

protected

_onInv(msg: InvMessage): Promise<void>

protected

_onKnownBlockAnnounced(hash: Hash, block: Block): void

protected

_onKnownTransactionAnnounced(hash: Hash, transaction: Transaction): void

protected

_onNewBlockAnnounced(hash: Hash): void

protected
protected
protected
protected

_onObjectProcessed(vector: InvVector): void

protected

_onObjectReceived(vector: InvVector): void

protected
protected

async _onTx(msg: TxMessage): Promise

protected

async _processBlock(hash: Hash, block: Block): Promise<void>

protected

async _processHeader(hash: Hash, header: BlockHeader): Promise<void>

protected

async _processTransaction(hash: Hash, transaction: Transaction): Promise<void>

protected

_requestData(): void

protected

_shouldRequestData(vector: InvVector): boolean

Public Constructors

public constructor(blockchain: NanoChain, mempool: NanoMempool, time: Time, peer: Peer, invRequestManager: InvRequestManager, targetSubscription: Subscription) source

Override:

BaseConsensusAgent#constructor

Params:

NameTypeAttributeDescription
blockchain NanoChain
mempool NanoMempool
time Time
peer Peer
invRequestManager InvRequestManager
targetSubscription Subscription

Public Members

public get syncing: boolean source

Override:

BaseConsensusAgent#syncing

Public Methods

public getAccounts(blockHash: Hash, addresses: Array<Address>): Promise<Array<Account>> source

Params:

NameTypeAttributeDescription
blockHash Hash
addresses Array<Address>

Return:

Promise<Array<Account>>

public requestMempool() source

public async syncBlockchain(): Promise<void> source

Return:

Promise<void>

Protected Methods

protected _doRequestData(vectors: Array<InvVector>): void source

Override:

BaseConsensusAgent#_doRequestData

Params:

NameTypeAttributeDescription
vectors Array<InvVector>

Return:

void

protected _getBlock(hash: Hash, includeForks: boolean): PromiseBlock> source

Override:

BaseConsensusAgent#_getBlock

Params:

NameTypeAttributeDescription
hash Hash
includeForks boolean
  • optional

Return:

PromiseBlock>

protected _getTransaction(hash: Hash): Transaction source

Override:

BaseConsensusAgent#_getTransaction

Params:

NameTypeAttributeDescription
hash Hash

Return:

Transaction (nullable: true)

protected _onClose(): void source

Override:

BaseConsensusAgent#_onClose

Return:

void

protected async _processHeader(hash: Hash, header: BlockHeader): Promise<void> source

Override:

BaseConsensusAgent#_processHeader

Params:

NameTypeAttributeDescription
hash Hash
header BlockHeader

Return:

Promise<void>

protected _processTransaction(hash: Hash, transaction: Transaction): Promise<void> source

Override:

BaseConsensusAgent#_processTransaction

Params:

NameTypeAttributeDescription
hash Hash
transaction Transaction

Return:

Promise<void>