BitShares-Core  5.0.0
BitShares blockchain implementation and command-line interface software
Classes | Public Types | Public Member Functions | List of all members
graphene::app::network_broadcast_api Class Reference

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

#include <api.hpp>

Inheritance diagram for graphene::app::network_broadcast_api:

Classes

struct  transaction_confirmation
 

Public Types

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

Public Member Functions

 network_broadcast_api (application &a)
 
void broadcast_transaction (const precomputable_transaction &trx)
 Broadcast a transaction to the network. More...
 
void broadcast_transaction_with_callback (confirmation_callback cb, const precomputable_transaction &trx)
 
fc::variant broadcast_transaction_synchronous (const precomputable_transaction &trx)
 
void broadcast_block (const signed_block &block)
 Broadcast a signed block to the network. More...
 
void on_applied_block (const signed_block &b)
 Not reflected, thus not accessible to API clients. More...
 

Detailed Description

The network_broadcast_api class allows broadcasting of transactions.

Definition at line 253 of file api.hpp.

Member Typedef Documentation

Definition at line 266 of file api.hpp.

Constructor & Destructor Documentation

graphene::app::network_broadcast_api::network_broadcast_api ( application a)

Definition at line 151 of file api.cpp.

Member Function Documentation

void graphene::app::network_broadcast_api::broadcast_block ( const signed_block &  block)

Broadcast a signed block to the network.

Parameters
blockThe signed block to broadcast

Definition at line 198 of file api.cpp.

void graphene::app::network_broadcast_api::broadcast_transaction ( const precomputable_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 180 of file api.cpp.

fc::variant graphene::app::network_broadcast_api::broadcast_transaction_synchronous ( const precomputable_transaction &  trx)

This version of broadcast transaction waits until the transaction is included into a block, then the transaction id, block number, and transaction number in the block will be returned.

Parameters
trxthe transaction
Returns
info about the block including the transaction

Definition at line 188 of file api.cpp.

void graphene::app::network_broadcast_api::broadcast_transaction_with_callback ( confirmation_callback  cb,
const precomputable_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.

Parameters
cbthe callback method
trxthe transaction

Definition at line 206 of file api.cpp.

void graphene::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

Definition at line 156 of file api.cpp.


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