File tree 2 files changed +18
-0
lines changed
2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change 39
39
40
40
#include < fc/crypto/hex.hpp>
41
41
#include < fc/smart_ref_impl.hpp>
42
+ #include < fc/thread/future.hpp>
42
43
43
44
namespace graphene { namespace app {
44
45
@@ -159,6 +160,16 @@ namespace graphene { namespace app {
159
160
_app.p2p_node ()->broadcast_transaction (trx);
160
161
}
161
162
163
+ fc::variant network_broadcast_api::broadcast_transaction_synchronous (const signed_transaction& trx)
164
+ {
165
+ fc::promise<fc::variant>::ptr prom ( new fc::promise<fc::variant>() );
166
+ broadcast_transaction_with_callback ( [=]( const fc::variant& v ){
167
+ prom->set_value (v);
168
+ }, trx );
169
+
170
+ return fc::future<fc::variant>(prom).wait ();
171
+ }
172
+
162
173
void network_broadcast_api::broadcast_block ( const signed_block& b )
163
174
{
164
175
_app.chain_database ()->push_block (b);
Original file line number Diff line number Diff line change @@ -195,6 +195,12 @@ namespace graphene { namespace app {
195
195
*/
196
196
void broadcast_transaction_with_callback ( confirmation_callback cb, const signed_transaction& trx);
197
197
198
+ /* * this version of broadcast transaction registers a callback method that will be called when the transaction is
199
+ * included into a block. The callback method includes the transaction id, block number, and transaction number in the
200
+ * block.
201
+ */
202
+ fc::variant broadcast_transaction_synchronous (const signed_transaction& trx);
203
+
198
204
void broadcast_block ( const signed_block& block );
199
205
200
206
/* *
@@ -394,6 +400,7 @@ FC_API(graphene::app::block_api,
394
400
FC_API(graphene::app::network_broadcast_api,
395
401
(broadcast_transaction)
396
402
(broadcast_transaction_with_callback)
403
+ (broadcast_transaction_synchronous)
397
404
(broadcast_block)
398
405
)
399
406
FC_API(graphene::app::network_node_api,
You can’t perform that action at this time.
0 commit comments