IBlockchainExplorer methods and callbacks

From Bytecoin Wiki
Jump to: navigation, search

IBlockchainExplorer Interface

IBlockchainExplorer 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. IBlockchainObserver* observer Pointer to instance of IBlockchainObserver class bool Returns true if observer was added or false if observer was not added (already added)
removeObserver Removes an observer from the list. sync. IBlockchainObserver* observer Pointer to instance of IBlockchainObserver class bool Returns true if observer was removed or false if observer was not removed (not found)
init Method for BlockchainExplorer initialization. Any other method called before init will throw CryptoNote::error::BlockchainExplorerErrorCodes::NOT_INITIALIZED sync. - - - -
shutdown This method MUST be called before object destruction. After this method’s call object can be started by init method sync. - - - -
getBlocks Method for getting blocks by heights sync. const std::vector<uint64_t>& blockHeights Collection of requested block heights bool Returns true if all requested blocks are written and no errors occurred
std::vector<std::vector<BlockDetails>>& blocks Collecton to write requested blocks to. There may be more than one block on same height
getBlocks Method for getting blocks by hashes sync. const std::vector<Crypto::Hash>& blockHashes Collection of block hashes bool Returns true if all requested blocks are written and no errors occurred
std::vector<BlockDetails>& blocks Collection to write requested blocks to
getBlocks Method for getting blocks by timestamp range sync. uint64_t timestampBegin Beginning of timestamp range bool Returns true if all requested blocks are written and no errors occurred
uint64_t timestampEnd End of timestamp range
uint32_t blocksNumberLimit Max number of blocks to return
std::vector<BlockDetails>& blocks Collection to write requested blocks to
uint64_t& blocksNumberWithinTimestamps Total number of blocks within requested range
getBlockchainTop Method for getting top main chain block sync BlockDetails& topBlock BlockDetails structure to write top main chain block bool Returns true if top main chain block is written and no errors occurred
getTransactions Method for getting transactions by hashes sync. const std::vector<Crypto::Hash>& transactionHashes Collection of transaction hashes bool Returns true if all requested transactions are written and no errors occurred
std::vector<TransactionDetails>& transactions Collection to write requested transactions to
getTransactionsByPaymentId Method for getting transactions by payment id sync. const Crypto::Hash& paymentId Payment id bool Returns true if all requested transactions are written and no errors occurred
std::vector<TransactionDetails>& transactions Collection to write transactions associated with requested payment id to
getPoolTransactions Method for getting transactions from transaction pool by timestamp range sync. uint64_t timestampBegin Beginning of timestamp range bool Returns true if all requested transactions are written and no errors occurred
uint64_t timestampEnd End of timestamp range
uint32_t transactionsNumberLimit Max number of transactions to return
std::vector<TransactionDetails>& transactions Collection to write requested transactions to
uint64_t& transactionsNumberWithinTimestamps Total number of transactions within requested range
getPoolState Returns the difference between network's transactions pool and user's sync. const std::vector<Crypto::Hash>& knownPoolTransactionHashes Known pool transactions bool Returns true if all transactions are written and no errors occurred
Crypto::Hash knownBlockchainTop Known blockchain top
bool& isBlockchainActual Set to false if known blockchain top is not actual
std::vector<TransactionDetails>& newTransactions Collection to write new transactions to
std::vector<Crypto::Hash>& removedTransactions Collecton to write removed transaction hashes to
getRewardBlocksWindow Returns number of last blocks that were used to calculate the reward sync - - uint64_t Number of last blocks that were used to calculate the reward
getFullRewardMaxBlockSize Returns max size of block that can be generated without penalty sync uint8_t majorVersion Major version of blocks (currently 2) uint64_t Max size of block that can be generated without penalty
isSynchronized Returns synchronization status sync - - bool Synchronization status

IBlockchainObserver

IBlockchainObserver is an interface used to receive notifications about events in the blockchain and transaction pool.

Method Description Type Input Parameters Input Description Output Parameters Output Description
blockchainUpdated Notifies about new blocks - const std::vector<BlockDetails>& newBlocks New blocks in main chain - -
const std::vector<BlockDetails>& orphanedBlocks New blocks in alternative chains
poolUpdated Notifies about new transactions in pool - const std::vector<TransactionDetails>& newTransactions New transactions in pool - -
const std::vector<std::pair<Crypto::Hash, TransactionRemoveReason>>& removedTransactions Transaction hashes removed from pool
blockchainSynchronized Notifies about node synchronization procedure completed - const BlockDetails& topBlock Top main chain block - -
Personal tools
Namespaces

Variants
Actions
Navigation
Tools