Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/rawtransaction.cpp
Show First 20 Lines • Show All 971 Lines • ▼ Show 20 Lines | static UniValue sendrawtransaction(const Config &config, | ||||
} else if (request.params[1].isNum()) { | } else if (request.params[1].isNum()) { | ||||
size_t sz = tx->GetTotalSize(); | size_t sz = tx->GetTotalSize(); | ||||
CFeeRate fr(AmountFromValue(request.params[1])); | CFeeRate fr(AmountFromValue(request.params[1])); | ||||
max_raw_tx_fee = fr.GetFee(sz); | max_raw_tx_fee = fr.GetFee(sz); | ||||
} else if (!request.params[1].isNull()) { | } else if (!request.params[1].isNull()) { | ||||
throw JSONRPCError(RPC_INVALID_PARAMETER, | throw JSONRPCError(RPC_INVALID_PARAMETER, | ||||
"second argument (maxfeerate) must be numeric"); | "second argument (maxfeerate) must be numeric"); | ||||
} | } | ||||
TxId txid; | |||||
std::string err_string; | std::string err_string; | ||||
const TransactionError err = | AssertLockNotHeld(cs_main); | ||||
BroadcastTransaction(config, tx, txid, err_string, max_raw_tx_fee); | const TransactionError err = BroadcastTransaction( | ||||
config, tx, err_string, max_raw_tx_fee, /*relay*/ true, | |||||
/*wait_callback*/ true); | |||||
if (err != TransactionError::OK) { | if (err != TransactionError::OK) { | ||||
throw JSONRPCTransactionError(err, err_string); | throw JSONRPCTransactionError(err, err_string); | ||||
} | } | ||||
return txid.GetHex(); | return tx->GetHash().GetHex(); | ||||
} | } | ||||
static UniValue testmempoolaccept(const Config &config, | static UniValue testmempoolaccept(const Config &config, | ||||
const JSONRPCRequest &request) { | const JSONRPCRequest &request) { | ||||
const RPCHelpMan help{ | const RPCHelpMan help{ | ||||
"testmempoolaccept", | "testmempoolaccept", | ||||
"\nReturns if raw transaction (serialized, hex-encoded) would be " | "\nReturns if raw transaction (serialized, hex-encoded) would be " | ||||
"accepted by mempool.\n" | "accepted by mempool.\n" | ||||
▲ Show 20 Lines • Show All 1,007 Lines • Show Last 20 Lines |