Scorum
Classes | Public Types | Public Member Functions | List of all members
scorum::app::network_broadcast_api Class Reference

The network_broadcast_api class allows broadcasting of transactions. More...

#include <api.hpp>

Inheritance diagram for scorum::app::network_broadcast_api:

Classes

struct  transaction_confirmation
 

Public Types

typedef std::function< void(variant)> confirmation_callback
 

Public Member Functions

 network_broadcast_api (const api_context &a)
 
void broadcast_transaction (const signed_transaction &trx)
 Broadcast a transaction to the network. More...
 
void broadcast_transaction_with_callback (confirmation_callback cb, const signed_transaction &trx)
 
fc::variant broadcast_transaction_synchronous (const signed_transaction &trx)
 
void broadcast_block (const signed_block &block)
 
void set_max_block_age (int32_t max_block_age)
 
bool check_max_block_age (int32_t max_block_age)
 
void on_applied_block (const signed_block &b)
 Not reflected, thus not accessible to API clients. More...
 
void on_api_startup ()
 internal method, not exposed via JSON RPC More...
 

Detailed Description

The network_broadcast_api class allows broadcasting of transactions.

Definition at line 55 of file api.hpp.

Member Typedef Documentation

◆ confirmation_callback

typedef std::function<void(variant )> scorum::app::network_broadcast_api::confirmation_callback

Definition at line 76 of file api.hpp.

Constructor & Destructor Documentation

◆ network_broadcast_api()

scorum::app::network_broadcast_api::network_broadcast_api ( const api_context a)

NOTE: cannot register callbacks in constructor because shared_from_this() is not valid.

Definition at line 128 of file api.cpp.

Member Function Documentation

◆ broadcast_block()

void scorum::app::network_broadcast_api::broadcast_block ( const signed_block block)

Definition at line 240 of file api.cpp.

◆ broadcast_transaction()

void scorum::app::network_broadcast_api::broadcast_transaction ( const signed_transaction trx)

Broadcast a transaction to the network.

Parameters
trxThe transaction to broadcast

The transaction will be checked for validity in the local database prior to broadcasting. If it fails to apply locally, an error will be thrown and the transaction will not be broadcast.

Definition at line 210 of file api.cpp.

◆ broadcast_transaction_synchronous()

fc::variant scorum::app::network_broadcast_api::broadcast_transaction_synchronous ( const signed_transaction trx)

This call will not return until the transaction is included in a block.

Definition at line 226 of file api.cpp.

◆ broadcast_transaction_with_callback()

void scorum::app::network_broadcast_api::broadcast_transaction_with_callback ( confirmation_callback  cb,
const signed_transaction trx 
)

this version of broadcast transaction registers a callback method that will be called when the transaction is included into a block. The callback method includes the transaction id, block number, and transaction number in the block.

Definition at line 322 of file api.cpp.

◆ check_max_block_age()

bool scorum::app::network_broadcast_api::check_max_block_age ( int32_t  max_block_age)

Definition at line 143 of file api.cpp.

◆ on_api_startup()

void scorum::app::network_broadcast_api::on_api_startup ( )

internal method, not exposed via JSON RPC

note cannot capture shared pointer here, because _applied_block_connection will never be freed if the lambda holds a reference to it.

Definition at line 135 of file api.cpp.

◆ on_applied_block()

void scorum::app::network_broadcast_api::on_applied_block ( const signed_block b)

Not reflected, thus not accessible to API clients.

This function is registered to receive the applied_block signal from the chain database when a block is received. It then dispatches callbacks to clients who have requested to be notified when a particular txid is included in a block.

we need to ensure the database_api is not deleted for the life of the async operation

clear all expirations

fc::async

Definition at line 162 of file api.cpp.

◆ set_max_block_age()

void scorum::app::network_broadcast_api::set_max_block_age ( int32_t  max_block_age)

Definition at line 157 of file api.cpp.


The documentation for this class was generated from the following files: