9#include <chainparams.h>
28#include <validation.h>
42 "Submits raw transaction (serialized, hex-encoded) to local node and "
44 "\nAlso see createrawtransaction and "
45 "signrawtransactionwithkey calls.\n",
48 "The hex string of the raw transaction"},
51 FormatMoney(DEFAULT_MAX_RAW_TX_FEE_RATE.GetFeePerK())},
52 "Reject transactions whose fee rate is higher than the specified "
53 "value, expressed in " +
55 "/kB\nSet to 0 to accept any fee rate.\n"},
59 "\nCreate a transaction\n" +
61 "createrawtransaction",
62 "\"[{\\\"txid\\\" : \\\"mytxid\\\",\\\"vout\\\":0}]\" "
63 "\"{\\\"myaddress\\\":10000}\"") +
64 "Sign the transaction, and get back the hex\n" +
66 "\nSend the transaction (signed hex)\n" +
68 "\nAs a JSON-RPC call\n" +
74 if (!
DecodeHexTx(mtx, request.params[0].get_str())) {
82 request.params[1].isNull()
83 ? DEFAULT_MAX_RAW_TX_FEE_RATE
87 Amount max_raw_tx_fee = max_raw_tx_fee_rate.
GetFee(virtual_size);
89 std::string err_string;
92 const TransactionError err = BroadcastTransaction(
93 node, tx, err_string, max_raw_tx_fee,
true,
95 if (err != TransactionError::OK) {
101 ->SyncWithValidationInterfaceQueue();
103 return tx->GetHash().GetHex();
112 "\nReturns result of mempool acceptance tests indicating if raw "
113 "transaction(s) (serialized, hex-encoded) would be accepted by "
115 "\nIf multiple transactions are passed in, parents must come before "
116 "children and package policies apply: the transactions cannot conflict "
117 "with any mempool transactions or each other.\n"
118 "\nIf one transaction fails, other transactions may not be fully "
119 "validated (the 'allowed' key will be blank).\n"
120 "\nThe maximum number of transactions allowed is " +
123 "\nThis checks if transactions violate the consensus or policy "
125 "\nSee sendrawtransaction call.\n",
131 "An array of hex strings of raw transactions.",
139 FormatMoney(DEFAULT_MAX_RAW_TX_FEE_RATE.GetFeePerK())},
140 "Reject transactions whose fee rate is higher than the specified "
141 "value, expressed in " +
147 "The result of the mempool acceptance test for each raw "
148 "transaction in the input array.\n"
149 "Returns results for each transaction in the same order they were "
151 "Transactions that cannot be fully validated due to failures in "
152 "other transactions will not contain an 'allowed' result.\n",
159 "The transaction hash in hex"},
161 "Package validation error, if any (only possible if "
162 "rawtxs had more than 1 transaction)."},
164 "Whether this tx would be accepted to the mempool and "
165 "pass client-specified maxfeerate. "
166 "If not present, the tx was not fully validated due to a "
167 "failure in another tx in the list."},
171 "Transaction fees (only present if 'allowed' is true)",
174 "transaction fee in " + ticker},
176 "the effective feerate in " + ticker +
177 " per KvB. May differ from the base feerate if, "
178 "for example, there are modified fees from "
179 "prioritisetransaction or a package feerate was "
182 "effective-includes",
183 "transactions whose fees and vsizes are included in "
184 "effective-feerate.",
187 "transaction txid in hex"},
191 "Rejection string (only present when 'allowed' is "
194 "Rejection details (only present when 'allowed' is false "
195 "and rejection details exist)"},
200 "\nCreate a transaction\n" +
202 "createrawtransaction",
203 "\"[{\\\"txid\\\" : \\\"mytxid\\\",\\\"vout\\\":0}]\" "
204 "\"{\\\"myaddress\\\":10000}\"") +
205 "Sign the transaction, and get back the hex\n" +
207 "\nTest acceptance of the transaction (signed hex)\n" +
209 "\nAs a JSON-RPC call\n" +
214 if (raw_transactions.
size() < 1 ||
217 "Array must contain between 1 and " +
222 const CFeeRate max_raw_tx_fee_rate =
223 request.params[1].isNull()
224 ? DEFAULT_MAX_RAW_TX_FEE_RATE
227 std::vector<CTransactionRef> txns;
228 txns.reserve(raw_transactions.
size());
229 for (
const auto &rawtx : raw_transactions.
getValues()) {
233 "TX decode failed: " + rawtx.get_str());
244 if (txns.size() > 1) {
260 bool exit_early{
false};
261 for (
const auto &tx : txns) {
263 result_inner.
pushKV(
"txid", tx->GetId().GetHex());
270 auto it = package_result.
m_tx_results.find(tx->GetId());
271 if (exit_early || it == package_result.
m_tx_results.end()) {
273 rpc_result.
push_back(std::move(result_inner));
276 const auto &tx_result = it->second;
281 if (tx_result.m_result_type ==
283 const Amount fee = tx_result.m_base_fees.value();
285 const int64_t virtual_size = tx_result.m_vsize.value();
286 const Amount max_raw_tx_fee =
287 max_raw_tx_fee_rate.
GetFee(virtual_size);
289 fee > max_raw_tx_fee) {
290 result_inner.
pushKV(
"allowed",
false);
291 result_inner.
pushKV(
"reject-reason",
298 result_inner.
pushKV(
"allowed",
true);
299 result_inner.
pushKV(
"size", virtual_size);
304 tx_result.m_effective_feerate.value().GetFeePerK());
306 for (
const auto &txid :
307 tx_result.m_txids_fee_calculations.value()) {
308 effective_includes_res.
push_back(txid.ToString());
310 fees.
pushKV(
"effective-includes",
311 std::move(effective_includes_res));
312 result_inner.
pushKV(
"fees", std::move(fees));
315 result_inner.
pushKV(
"allowed",
false);
319 result_inner.
pushKV(
"reject-reason",
"missing-inputs");
321 result_inner.
pushKV(
"reject-reason",
326 rpc_result.
push_back(std::move(result_inner));
338 "local time transaction entered pool in seconds since 1 Jan "
341 "block height when transaction entered pool"},
347 "transaction fee in " + ticker},
349 "transaction fee with fee deltas used for "
350 "mining priority in " +
356 "unconfirmed transactions used as inputs for this transaction",
358 "parent transaction id"}}},
362 "unconfirmed transactions spending outputs from this transaction",
364 "child transaction id"}}},
366 "Whether this transaction is currently unbroadcast (initial "
367 "broadcast not yet acknowledged by any peers)"},
377 fees.
pushKV(
"base", e->GetFee());
378 fees.
pushKV(
"modified", e->GetModifiedFee());
379 info.pushKV(
"fees", fees);
381 info.pushKV(
"size", (
int)e->GetTxSize());
383 info.pushKV(
"height", (
int)e->GetHeight());
385 std::set<std::string> setDepends;
387 if (pool.exists(txin.prevout.GetTxId())) {
388 setDepends.insert(txin.prevout.GetTxId().ToString());
393 for (
const std::string &dep : setDepends) {
397 info.pushKV(
"depends", std::move(depends));
400 for (
const auto &child : e->GetMemPoolChildrenConst()) {
401 spent.
push_back(child.get()->GetTx().GetId().ToString());
404 info.pushKV(
"spentby", std::move(spent));
405 info.pushKV(
"unbroadcast", pool.IsUnbroadcastTx(tx.
GetId()));
409 bool include_mempool_sequence) {
411 if (include_mempool_sequence) {
414 "Verbose results cannot contain mempool sequence values.");
419 const TxId &txid = e->GetTx().GetId();
429 uint64_t mempool_sequence;
430 std::vector<TxId> vtxids;
437 for (
const TxId &txid : vtxids) {
441 if (!include_mempool_sequence) {
445 o.
pushKV(
"txids", std::move(a));
446 o.
pushKV(
"mempool_sequence", mempool_sequence);
455 "Returns all transaction ids in memory pool as a json array of "
456 "string transaction ids.\n"
457 "\nHint: use getmempoolentry to fetch a specific transaction from the "
461 "True for a json object, false for array of transaction ids"},
463 "If verbose=false, returns a json object with transaction list "
464 "and mempool sequence number attached."},
483 "for verbose = false and mempool_sequence = true",
495 "The mempool sequence value."},
502 bool fVerbose =
false;
503 if (!request.params[0].isNull()) {
504 fVerbose = request.params[0].
get_bool();
507 bool include_mempool_sequence =
false;
508 if (!request.params[1].isNull()) {
509 include_mempool_sequence = request.params[1].get_bool();
513 include_mempool_sequence);
520 "getmempoolancestors",
521 "If txid is in the mempool, returns all in-mempool ancestors.\n",
524 "The transaction id (must be in mempool)"},
526 "True for a json object, false for array of transaction ids"},
530 "for verbose = false",
535 "The transaction id of an in-mempool ancestor transaction"}}},
549 bool fVerbose =
false;
550 if (!request.params[1].isNull()) {
551 fVerbose = request.params[1].
get_bool();
560 if (it == mempool.mapTx.end()) {
562 "Transaction not in mempool");
571 o.
push_back((*ancestorIt)->GetTx().GetId().ToString());
578 const TxId &_txid = e->GetTx().GetId();
591 "getmempooldescendants",
592 "If txid is in the mempool, returns all in-mempool descendants.\n",
595 "The transaction id (must be in mempool)"},
597 "True for a json object, false for array of transaction ids"},
605 "The transaction id of an in-mempool descendant "
620 bool fVerbose =
false;
621 if (!request.params[1].isNull()) {
622 fVerbose = request.params[1].
get_bool();
631 if (it == mempool.mapTx.end()) {
633 "Transaction not in mempool");
639 setDescendants.erase(it);
644 o.
push_back((*descendantIt)->GetTx().GetId().ToString());
652 const TxId &_txid = e->GetTx().GetId();
666 "Returns mempool data for given transaction\n",
669 "The transaction id (must be in mempool)"},
682 if (it == mempool.mapTx.end()) {
684 "Transaction not in mempool");
703 ret.
pushKV(
"finalized_txs_sigchecks",
720 "Returns details on the active state of the TX memory pool.\n",
728 "True if the initial load attempt of the persisted mempool "
733 "Current finalized tx count"},
735 "Sum of all finalized transaction sizes"},
737 "Sum of all finalized transaction sigchecks"},
739 "Total memory usage for the mempool"},
741 "Maximum memory usage for the mempool"},
743 "Total fees for the mempool in " + ticker +
744 ", ignoring modified fees through prioritisetransaction"},
746 "Minimum fee rate in " + ticker +
747 "/kB for tx to be accepted. Is the maximum of "
748 "minrelaytxfee and minimum mempool fee"},
750 "Current minimum relay fee for transactions"},
752 "Current number of transactions that haven't passed initial "
767 "Import a mempool.dat file and attempt to add its contents to the "
769 "Warning: Importing untrusted files is dangerous, especially if "
770 "metadata from the file is taken over.",
780 "Whether to use the current system time or use the entry "
781 "time metadata from the mempool file.\n"
782 "Warning: Importing untrusted metadata may lead to "
783 "unexpected issues and undesirable behavior."},
786 "Whether to apply the fee delta metadata from the mempool "
788 "It will be added to any existing fee deltas.\n"
789 "The fee delta can be set by the prioritisetransaction RPC.\n"
790 "Warning: Importing untrusted metadata may lead to "
791 "unexpected issues and undesirable behavior.\n"
792 "Only set this bool if you understand what it does."},
795 "Whether to apply the unbroadcast set metadata from the "
797 "Warning: Importing untrusted metadata may lead to "
798 "unexpected issues and undesirable behavior."},
815 "Can only import the mempool after the "
816 "block download and sync is done.");
821 request.params[1][
"use_current_time"]};
823 request.params[1][
"apply_fee_delta_priority"]};
825 request.params[1][
"apply_unbroadcast_set"]};
829 : use_current_time.get_bool(),
830 .apply_fee_delta_priority = apply_fee_delta.isNull()
832 : apply_fee_delta.get_bool(),
833 .apply_unbroadcast_set = apply_unbroadcast.isNull()
835 : apply_unbroadcast.get_bool(),
841 "Unable to import mempool file, see "
842 "debug.log for details.");
854 "Dumps the mempool to disk. It will fail until the previous dump is "
862 "the directory and file where the mempool was saved"},
873 "The mempool was not loaded yet");
876 const fs::path &dump_path = MempoolPath(args);
878 if (!DumpMempool(mempool, dump_path)) {
880 "Unable to dump mempool to disk");
894 "The transaction hash in hex"},
896 "The serialized transaction size in bytes"},
898 "The entry time into the orphanage expressed in " +
913 o.
pushKV(
"txid", orphan.
tx->GetId().ToString());
914 o.
pushKV(
"bytes", orphan.
tx->GetTotalSize());
915 o.
pushKV(
"entry", int64_t{TicksSinceEpoch<std::chrono::seconds>(
917 o.
pushKV(
"expiration", int64_t{TicksSinceEpoch<std::chrono::seconds>(
920 for (
const auto fromPeer : orphan.
announcers) {
930 "\nShows transactions in the tx orphanage.\n"
931 "\nEXPERIMENTAL warning: this call may be changed in future "
935 "0 for an array of txids (may contain duplicates), 1 for an "
936 "array of objects with tx details, and 2 for details from (1) and "
947 "The transaction hash in hex"},
962 Cat<std::vector<RPCResult>>(
965 "The serialized, hex-encoded transaction "
975 std::vector<TxOrphanage::PoolTx> orphanage =
984 if (verbosity == 0) {
985 for (
const auto &orphan : orphanage) {
986 ret.
push_back(orphan.tx->GetId().ToString());
988 }
else if (verbosity == 1) {
989 for (
const auto &orphan : orphanage) {
992 }
else if (verbosity == 2) {
993 for (
const auto &orphan : orphanage) {
1000 "Invalid verbosity value " +
1001 ToString(verbosity));
1013 "Submit a package of raw transactions (serialized, hex-encoded) to "
1015 "The package must consist of a child with its parents, and none of the "
1016 "parents may depend on one another.\n"
1017 "The package will be validated according to consensus and mempool "
1018 "policy rules. If any transaction passes, it will be accepted to "
1020 "This RPC is experimental and the interface may be unstable. Refer to "
1021 "doc/policy/packages.md for documentation on package policies.\n"
1022 "Warning: successful submission does not mean the transactions will "
1023 "propagate throughout the network.\n",
1029 "An array of raw transactions.",
1042 "The transaction package result message. \"success\" "
1043 "indicates all transactions were accepted into or are already "
1047 "transaction results keyed by txid",
1053 "Virtual transaction size."},
1060 "transaction fee in " + ticker},
1062 "the effective feerate in " + ticker +
1063 " per KvB. May differ from the base feerate "
1064 "if, for example, there are modified fees "
1065 "from prioritisetransaction or a package "
1066 "feerate was used."},
1068 "effective-includes",
1069 "transactions whose fees and vsizes are included "
1070 "in effective-feerate.",
1073 "transaction txid in hex"},
1077 "The transaction error string, if it was rejected by "
1087 if (raw_transactions.
size() < 1 ||
1090 "Array must contain between 1 and " +
1095 std::vector<CTransactionRef> txns;
1096 txns.reserve(raw_transactions.
size());
1097 for (
const auto &rawtx : raw_transactions.
getValues()) {
1102 "TX decode failed: " + rawtx.get_str() +
1103 " Make sure the tx has at least one input.");
1109 TransactionError::INVALID_PACKAGE,
1110 "package topology disallowed. not child-with-parents or "
1111 "parents depend on each other.");
1121 std::string package_msg =
"success";
1124 switch (package_result.m_state.GetResult()) {
1130 for (
const auto &tx : txns) {
1139 TransactionError::MEMPOOL_ERROR,
1140 package_result.m_state.GetRejectReason());
1146 package_msg = package_result.m_state.GetRejectReason();
1149 package_result.m_tx_results.empty());
1153 size_t num_broadcast{0};
1154 for (
const auto &tx : txns) {
1157 if (!mempool.
exists(tx->GetId())) {
1163 std::string err_string;
1164 const auto err = BroadcastTransaction(
1167 if (err != TransactionError::OK) {
1170 strprintf(
"transaction broadcast failed: %s (%d "
1171 "transactions were broadcast successfully)",
1172 err_string, num_broadcast));
1178 rpc_result.
pushKV(
"package_msg", package_msg);
1180 for (
const auto &tx : txns) {
1182 auto it = package_result.m_tx_results.find(tx->GetId());
1183 if (it == package_result.m_tx_results.end()) {
1185 result_inner.
pushKV(
"error",
"unevaluated");
1188 const auto &tx_result = it->second;
1189 switch (it->second.m_result_type) {
1191 result_inner.pushKV(
"error",
1192 it->second.m_state.ToString());
1196 result_inner.pushKV(
1197 "vsize", int64_t{it->second.m_vsize.value()});
1199 fees.
pushKV(
"base", it->second.m_base_fees.value());
1200 if (tx_result.m_result_type ==
1207 fees.
pushKV(
"effective-feerate",
1208 tx_result.m_effective_feerate.value()
1211 for (
const auto &txid :
1212 tx_result.m_txids_fee_calculations.value()) {
1216 fees.
pushKV(
"effective-includes",
1217 std::move(effective_includes_res));
1219 result_inner.pushKV(
"fees", std::move(fees));
1222 tx_result_map.pushKV(tx->GetId().GetHex(),
1223 std::move(result_inner));
1225 rpc_result.pushKV(
"tx-results", std::move(tx_result_map));
1248 for (
const auto &c : commands) {
#define CHECK_NONFATAL(condition)
Identity function.
Fee rate in satoshis per virtualbyte: Amount / vB the feerate is represented internally as FeeFrac.
Amount GetFee(int32_t virtual_bytes) const
Return the fee in satoshis for the given size in bytes.
Amount GetFeePerK() const
Return the fee in satoshis for a size of 1000 bytes.
A mutable version of CTransaction.
void appendCommand(const std::string &name, const CRPCCommand *pcmd)
Appends a CRPCCommand to the dispatch table.
The basic transaction that is broadcasted on the network and contained in blocks.
const std::vector< CTxIn > vin
An input of a transaction.
CTxMemPool stores valid-according-to-the-current-best-chain transactions that may be included in the ...
std::set< txiter, CompareIteratorById > setEntries
bool GetLoadTried() const
CFeeRate GetMinFee() const
The minimum fee to get into the mempool, which may itself not be enough for larger-sized transactions...
RecursiveMutex cs
This mutex needs to be locked when accessing mapTx or other members that are guarded by it.
Amount GetTotalFee() const EXCLUSIVE_LOCKS_REQUIRED(cs)
uint64_t GetTotalFinalizedTxSigchecks() const EXCLUSIVE_LOCKS_REQUIRED(cs)
void getAllTxIds(std::vector< TxId > &vtxid) const
size_t DynamicMemoryUsage() const
bool exists(const TxId &txid) const
std::set< TxId > GetUnbroadcastTxs() const
Returns transactions in unbroadcast set.
uint64_t GetSequence() const EXCLUSIVE_LOCKS_REQUIRED(cs)
indexed_transaction_set::nth_index< 0 >::type::const_iterator txiter
uint64_t GetFinalizedTxCount() const EXCLUSIVE_LOCKS_REQUIRED(cs)
void CalculateMemPoolAncestors(const CTxMemPoolEntryRef &entry, setEntries &setAncestors, bool unfinalizedOnly=false) const EXCLUSIVE_LOCKS_REQUIRED(cs)
Calculate all in-mempool ancestors of entry.
uint64_t GetTotalFinalizedTxSize() const EXCLUSIVE_LOCKS_REQUIRED(cs)
void CalculateDescendants(txiter it, setEntries &setDescendants) const EXCLUSIVE_LOCKS_REQUIRED(cs)
Populate setDescendants with all in-mempool descendants of hash.
unsigned long size() const
uint64_t GetTotalTxSize() const EXCLUSIVE_LOCKS_REQUIRED(cs)
Chainstate stores and provides an API to update our local knowledge of the current best chain.
Provides an interface for creating and interacting with one or two chainstates: an IBD chainstate gen...
SnapshotCompletionResult MaybeCompleteSnapshotValidation() EXCLUSIVE_LOCKS_REQUIRED(const CBlockIndex *GetSnapshotBaseBlock() const EXCLUSIVE_LOCKS_REQUIRED(Chainstate ActiveChainstate)() const
Once the background validation chainstate has reached the height which is the base of the UTXO snapsh...
MempoolAcceptResult ProcessTransaction(const CTransactionRef &tx, bool test_accept=false) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
Try to add a transaction to the memory pool.
bool IsInitialBlockDownload() const
Check whether we are doing an initial block download (synchronizing from disk or network)
virtual std::vector< TxOrphanage::PoolTx > GetOrphanTransactions()=0
void push_back(UniValue val)
const std::vector< UniValue > & getValues() const
void pushKVEnd(std::string key, UniValue val)
const UniValue & get_array() const
void pushKV(std::string key, UniValue val)
std::string GetRejectReason() const
std::string ToString() const
std::string ToString() const
Path class wrapper to block calls to the fs::path(std::string) implicit constructor and the fs::path:...
std::string u8string() const
@ TX_MISSING_INPUTS
transaction was missing some of its inputs
std::string EncodeHexTx(const CTransaction &tx)
bool DecodeHexTx(CMutableTransaction &tx, const std::string &strHexTx)
RecursiveMutex cs_main
Mutex to guard access to validation specific variables, such as reading or changing the chainstate.
static RPCHelpMan getmempoolinfo()
static RPCHelpMan sendrawtransaction()
static std::vector< RPCResult > OrphanDescription()
static RPCHelpMan importmempool()
static UniValue OrphanToJSON(const TxOrphanage::PoolTx &orphan)
void RegisterMempoolRPCCommands(CRPCTable &t)
Register mempool RPC commands.
static RPCHelpMan getrawmempool()
static RPCHelpMan getmempoolentry()
UniValue MempoolInfoToJSON(const CTxMemPool &pool)
Mempool information to JSON.
static std::vector< RPCResult > MempoolEntryDescription()
static RPCHelpMan submitpackage()
static RPCHelpMan getorphantxs()
UniValue MempoolToJSON(const CTxMemPool &pool, bool verbose, bool include_mempool_sequence)
Mempool to JSON.
static void entryToJSON(const CTxMemPool &pool, UniValue &info, const CTxMemPoolEntryRef &e) EXCLUSIVE_LOCKS_REQUIRED(pool.cs)
static RPCHelpMan testmempoolaccept()
static RPCHelpMan getmempooldescendants()
static RPCHelpMan getmempoolancestors()
static RPCHelpMan savemempool()
std::string FormatMoney(const Amount amt)
Do not use these functions to represent or parse monetary amounts to or from JSON but use AmountFromV...
static path u8path(const std::string &utf8_str)
bool LoadMempool(CTxMemPool &pool, const fs::path &load_path, Chainstate &active_chainstate, ImportMempoolOptions &&opts)
Import the file and attempt to add its contents to the mempool.
bool DumpMempool(const CTxMemPool &pool, const fs::path &dump_path, FopenFn mockable_fopen_function, bool skip_file_commit)
fs::path MempoolPath(const ArgsManager &argsman)
static const CFeeRate DEFAULT_MAX_RAW_TX_FEE_RATE
Maximum fee rate for sendrawtransaction and testmempoolaccept RPC calls.
std::string ToString(const T &t)
Locale-independent version of std::to_string.
is a home for public enum and struct type definitions that are used by internally by node code,...
bool IsChildWithParentsTree(const Package &package)
Context-free check that a package IsChildWithParents() and none of the parents depend on each other (...
static constexpr uint32_t MAX_PACKAGE_COUNT
Default maximum number of transactions in a package.
@ PCKG_POLICY
The package itself is invalid (e.g. too many transactions).
@ PCKG_RESULT_UNSET
Initial value. The package has not yet been rejected.
@ PCKG_MEMPOOL_ERROR
Mempool logic error.
@ PCKG_TX
At least one tx is invalid.
int64_t GetVirtualTransactionSize(int64_t nSize, int64_t nSigChecks, unsigned int bytes_per_sigCheck)
Compute the virtual transaction size (size, or more if sigChecks are too dense).
static CTransactionRef MakeTransactionRef()
std::shared_ptr< const CTransaction > CTransactionRef
UniValue JSONRPCError(int code, const std::string &message)
@ RPC_MISC_ERROR
General application defined errors std::exception thrown in command handling.
@ RPC_INVALID_PARAMETER
Invalid, missing or duplicate parameter.
@ RPC_CLIENT_IN_INITIAL_DOWNLOAD
Still downloading initial blocks.
@ RPC_DESERIALIZATION_ERROR
Error parsing or validating structure in raw format.
@ RPC_INVALID_ADDRESS_OR_KEY
Invalid address or key.
std::string HelpExampleCli(const std::string &methodname, const std::string &args)
UniValue JSONRPCTransactionError(TransactionError terr, const std::string &err_string)
Amount AmountFromValue(const UniValue &value)
std::string HelpExampleRpc(const std::string &methodname, const std::string &args)
const std::string UNIX_EPOCH_TIME
String used to describe UNIX epoch time in documentation, factored out to a constant for consistency.
int ParseVerbosity(const UniValue &arg, int default_verbosity, bool allow_bool)
Parses verbosity from provided UniValue.
uint256 ParseHashV(const UniValue &v, std::string strName)
Utilities: convert hex-encoded values (throws error if not hex).
NodeContext & EnsureAnyNodeContext(const std::any &context)
CTxMemPool & EnsureMemPool(const NodeContext &node)
PeerManager & EnsurePeerman(const NodeContext &node)
ChainstateManager & EnsureChainman(const NodeContext &node)
CTxMemPool & EnsureAnyMemPool(const std::any &context)
ArgsManager & EnsureAnyArgsman(const std::any &context)
static constexpr Amount zero() noexcept
static std::string getTicker()
@ MEMPOOL_ENTRY
Valid, transaction was already in the mempool.
@ VALID
Fully validated, valid.
Validation result for package mempool acceptance.
PackageValidationState m_state
std::map< TxId, MempoolAcceptResult > m_tx_results
Map from txid to finished MempoolAcceptResults.
@ STR_HEX
Special type that is a STR with only hex chars.
@ AMOUNT
Special type representing a floating point amount (can be either NUM or STR)
@ OBJ_NAMED_PARAMS
Special type that behaves almost exactly like OBJ, defining an options object with a list of pre-defi...
@ OMITTED
Optional argument for which the default value is omitted from help text for one of two reasons:
std::string oneline_description
Should be empty unless it is supposed to override the auto-generated summary line.
@ NUM_TIME
Special numeric to denote unix epoch time.
@ OBJ_DYN
Special dictionary with keys that are not literals.
@ STR_HEX
Special string with only hex chars.
@ STR_AMOUNT
Special string to represent a floating point amount.
A TxId is the identifier of a transaction.
Allows providing pool transaction information externally.
std::set< NodeId > announcers
Peers added with AddTx or AddAnnouncer.
CFeeRate min_relay_feerate
A fee rate smaller than this is considered zero fee (for relaying, mining and transaction creation)
NodeContext struct containing references to chain state and connection state.
#define AssertLockNotHeld(cs)
#define WITH_LOCK(cs, code)
Run code while locking a mutex.
#define AssertLockHeld(cs)
#define EXCLUSIVE_LOCKS_REQUIRED(...)
constexpr int64_t count_seconds(std::chrono::seconds t)
static constexpr auto ORPHAN_TX_EXPIRE_TIME
Expiration time for orphan transactions.
PackageMempoolAcceptResult ProcessNewPackage(Chainstate &active_chainstate, CTxMemPool &pool, const Package &package, bool test_accept)
Validate (and maybe submit) a package to the mempool.