Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/rawtransaction.cpp
Show First 20 Lines • Show All 1,031 Lines • ▼ Show 20 Lines | if (request.params[1].isBool()) { | ||||
"second argument (maxfeerate) must be numeric"); | "second argument (maxfeerate) must be numeric"); | ||||
} | } | ||||
UniValue result(UniValue::VARR); | UniValue result(UniValue::VARR); | ||||
UniValue result_0(UniValue::VOBJ); | UniValue result_0(UniValue::VOBJ); | ||||
result_0.pushKV("txid", txid.GetHex()); | result_0.pushKV("txid", txid.GetHex()); | ||||
CValidationState state; | CValidationState state; | ||||
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), &missing_inputs, | config, g_mempool, state, std::move(tx), false /* bypass_limits */, | ||||
false /* bypass_limits */, max_raw_tx_fee, true /* test_accept */); | max_raw_tx_fee, true /* test_accept */); | ||||
} | } | ||||
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()) { | ||||
if (state.GetReason() == | |||||
ValidationInvalidReason::TX_MISSING_INPUTS) { | |||||
result_0.pushKV("reject-reason", "missing-inputs"); | |||||
} else { | |||||
result_0.pushKV("reject-reason", | result_0.pushKV("reject-reason", | ||||
strprintf("%i: %s", state.GetRejectCode(), | strprintf("%i: %s", state.GetRejectCode(), | ||||
state.GetRejectReason())); | state.GetRejectReason())); | ||||
} else if (missing_inputs) { | } | ||||
result_0.pushKV("reject-reason", "missing-inputs"); | |||||
} else { | } else { | ||||
result_0.pushKV("reject-reason", state.GetRejectReason()); | result_0.pushKV("reject-reason", state.GetRejectReason()); | ||||
} | } | ||||
} | } | ||||
result.push_back(std::move(result_0)); | result.push_back(std::move(result_0)); | ||||
return result; | return result; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 936 Lines • Show Last 20 Lines |