Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/rawtransaction.cpp
Show First 20 Lines • Show All 1,030 Lines • ▼ Show 20 Lines | if (request.params[1].isBool()) { | ||||
throw JSONRPCError(RPC_INVALID_PARAMETER, | throw JSONRPCError(RPC_INVALID_PARAMETER, | ||||
"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; | TxValidationState state; | ||||
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), false /* bypass_limits */, | config, g_mempool, state, std::move(tx), 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() == | if (state.GetResult() == TxValidationResult::TX_MISSING_INPUTS) { | ||||
ValidationInvalidReason::TX_MISSING_INPUTS) { | |||||
result_0.pushKV("reject-reason", "missing-inputs"); | result_0.pushKV("reject-reason", "missing-inputs"); | ||||
} else { | } 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 { | } else { | ||||
result_0.pushKV("reject-reason", state.GetRejectReason()); | result_0.pushKV("reject-reason", state.GetRejectReason()); | ||||
▲ Show 20 Lines • Show All 942 Lines • Show Last 20 Lines |