Changeset View
Changeset View
Standalone View
Standalone View
src/node/transaction.cpp
Show All 17 Lines | |||||
#include <future> | #include <future> | ||||
TransactionError BroadcastTransaction(NodeContext &node, const Config &config, | TransactionError BroadcastTransaction(NodeContext &node, const Config &config, | ||||
const CTransactionRef tx, | const CTransactionRef tx, | ||||
std::string &err_string, | std::string &err_string, | ||||
const Amount max_tx_fee, bool relay, | const Amount max_tx_fee, bool relay, | ||||
bool wait_callback) { | bool wait_callback) { | ||||
assert(g_connman); | assert(node.connman); | ||||
std::promise<void> promise; | std::promise<void> promise; | ||||
TxId txid = tx->GetId(); | TxId txid = tx->GetId(); | ||||
bool callback_set = false; | bool callback_set = false; | ||||
{ // cs_main scope | { // cs_main scope | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
CCoinsViewCache &view = *pcoinsTip; | CCoinsViewCache &view = *pcoinsTip; | ||||
bool fHaveChain = false; | bool fHaveChain = false; | ||||
Show All 37 Lines | bool callback_set = false; | ||||
} | } | ||||
} // cs_main | } // cs_main | ||||
if (callback_set) { | if (callback_set) { | ||||
promise.get_future().wait(); | promise.get_future().wait(); | ||||
} | } | ||||
if (relay) { | if (relay) { | ||||
RelayTransaction(txid, *g_connman); | RelayTransaction(txid, *node.connman); | ||||
} | } | ||||
return TransactionError::OK; | return TransactionError::OK; | ||||
} | } |