Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/rawtransaction.cpp
Show First 20 Lines • Show All 1,188 Lines • ▼ Show 20 Lines | if (!request.params[1].isNull() && request.params[1].get_bool()) { | ||||
fHaveChain = !existingCoin.IsSpent(); | fHaveChain = !existingCoin.IsSpent(); | ||||
} | } | ||||
bool fHaveMempool = g_mempool.exists(txid); | bool fHaveMempool = g_mempool.exists(txid); | ||||
if (!fHaveMempool && !fHaveChain) { | if (!fHaveMempool && !fHaveChain) { | ||||
// Push to local node and sync with wallets. | // Push to local node and sync with wallets. | ||||
CValidationState state; | CValidationState state; | ||||
bool fMissingInputs; | bool fMissingInputs; | ||||
bool fLimitFree = false; | |||||
if (!AcceptToMemoryPool(config, g_mempool, state, std::move(tx), | if (!AcceptToMemoryPool(config, g_mempool, state, std::move(tx), | ||||
fLimitFree, &fMissingInputs, false, | &fMissingInputs, false /* bypass_limits */, | ||||
nMaxRawTxFee)) { | nMaxRawTxFee)) { | ||||
if (state.IsInvalid()) { | if (state.IsInvalid()) { | ||||
throw JSONRPCError(RPC_TRANSACTION_REJECTED, | throw JSONRPCError(RPC_TRANSACTION_REJECTED, | ||||
FormatStateMessage(state)); | FormatStateMessage(state)); | ||||
} | } | ||||
if (fMissingInputs) { | if (fMissingInputs) { | ||||
throw JSONRPCError(RPC_TRANSACTION_ERROR, "Missing inputs"); | throw JSONRPCError(RPC_TRANSACTION_ERROR, "Missing inputs"); | ||||
▲ Show 20 Lines • Show All 96 Lines • ▼ Show 20 Lines | static UniValue testmempoolaccept(const Config &config, | ||||
result_0.pushKV("txid", txid.GetHex()); | result_0.pushKV("txid", txid.GetHex()); | ||||
CValidationState state; | CValidationState state; | ||||
bool missing_inputs; | bool missing_inputs; | ||||
bool test_accept_res; | bool test_accept_res; | ||||
{ | { | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
test_accept_res = AcceptToMemoryPool( | test_accept_res = AcceptToMemoryPool( | ||||
config, g_mempool, state, std::move(tx), fLimitFree, | config, g_mempool, state, std::move(tx), &missing_inputs, | ||||
&missing_inputs, /* bypass_limits */ false, max_raw_tx_fee, | /* bypass_limits */ false, max_raw_tx_fee, | ||||
/* test_accept */ true); | /* test_accept */ true); | ||||
} | } | ||||
result_0.pushKV("allowed", test_accept_res); | result_0.pushKV("allowed", test_accept_res); | ||||
if (!test_accept_res) { | if (!test_accept_res) { | ||||
if (state.IsInvalid()) { | if (state.IsInvalid()) { | ||||
result_0.pushKV("reject-reason", | result_0.pushKV("reject-reason", | ||||
strprintf("%i: %s", state.GetRejectCode(), | strprintf("%i: %s", state.GetRejectCode(), | ||||
state.GetRejectReason())); | state.GetRejectReason())); | ||||
Show All 34 Lines |