Add BroadcastTransaction utility usage in Chain interface

Access through a broadcastTransaction method.
Add a wait_callback flag to turn off race protection when wallet
already track its tx being in mempool

Standardise highfee, absurdfee variable name to max_tx_fee

We drop the P2P check in BroadcastTransaction as g_connman is only
called by RPCs and the wallet scheduler, both of which are initialized
after g_connman is assigned and stopped before g_connman is reset.
This commit is contained in:
Antoine Riard
2019-04-11 14:37:30 +00:00
parent 7821821a23
commit 8c8aa19b4b
5 changed files with 34 additions and 19 deletions

View File

@@ -810,14 +810,14 @@ static UniValue sendrawtransaction(const JSONRPCRequest& request)
max_raw_tx_fee = fr.GetFee((weight+3)/4);
}
uint256 txid;
std::string err_string;
const TransactionError err = BroadcastTransaction(tx, txid, err_string, max_raw_tx_fee);
AssertLockNotHeld(cs_main);
const TransactionError err = BroadcastTransaction(tx, err_string, max_raw_tx_fee, /*relay*/ true, /*wait_callback*/ true);
if (TransactionError::OK != err) {
throw JSONRPCTransactionError(err, err_string);
}
return txid.GetHex();
return tx->GetHash().GetHex();
}
static UniValue testmempoolaccept(const JSONRPCRequest& request)