INode methods and callbacks

From Bytecoin Wiki
Jump to: navigation, search

INode Interface

INode interface contains the following methods:

Method Description Type Parameters Parameters Description Return Value Return Value Description
addObserver Adds a new observer to the observers list. When some event occurs, all observers are notified. sync. INodeObserver* observer Pointer to instance of INodeObserver class - -
removeObserver Removes an observer from the list. sync. INodeObserver* observer Pointer to instance of INodeObserver class - -
init Async method for node initialization. After initialization is finished, observers will receive a call of initCompleted method. async. - - - -
shutdown Kills all connections with network and stores blockchain data. After this method’s call object can be started by init method. sync. - - - -
getPeerCount Returns a number of peers connected to local node. sync. - - size_t Number of active peers
getLastLocalBlockHeight Returns height of last known block on a local node. sync. - - uint64_t Height of the block
getLastKnownBlockHeight Returns height of last known block in the network sync - - uint64_t height of the block
queryBlocks Returns blocks to a caller depending on known block hashes. sync. 1. std::list<crypto::hash>&& knownBlockIds

2. uint64_t timestamp

3. std::list<BlockCompleteEntry>& newBlocks

4. uint64_t& startHeight

5. const Callback& callback

- -
getPoolSymmetricDifference Returns the difference between network's transactions pool and user's. sync. - - - -


INodeObersver is an interface used to receive notifications about events in the blockchain.

Method Description Type Input Parameters Input Description Output Parameters Output Description
peerCountUpdated Notifies when peers number is changed. - size_t height Updated peers number - -
localBlockchainUpdated Notifies that height of the last block on the local node has been changed. - uint64_t height Height of last known block - -
lastKnownBlockHeightUpdated Notifies when the networks sends information about new blocks updates with height bigger than the last local's one. - uint64_t height Height of the block - -
poolChanged Notifies about changes in transaction pool. - - - - -
Personal tools