mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
dbg inject clang + permission check
This commit is contained in:
@@ -60,8 +60,8 @@ class TxQ
|
||||
private:
|
||||
std::mutex debugTxInjectMutex;
|
||||
std::vector<STTx> debugTxInjectQueue;
|
||||
public:
|
||||
|
||||
public:
|
||||
void
|
||||
debugTxInject(STTx const& txn);
|
||||
|
||||
|
||||
@@ -100,7 +100,6 @@ TxQ::debugTxInject(STTx const& txn)
|
||||
debugTxInjectQueue.push_back(txn);
|
||||
}
|
||||
|
||||
|
||||
std::size_t
|
||||
TxQ::FeeMetrics::update(
|
||||
Application& app,
|
||||
@@ -1454,26 +1453,23 @@ TxQ::accept(Application& app, OpenView& view)
|
||||
|
||||
// try to inject any debug txns waiting in the debug queue
|
||||
{
|
||||
std::unique_lock<std::mutex> trylock (TxQ::debugTxInjectMutex, std::try_to_lock);
|
||||
if(trylock.owns_lock() && !debugTxInjectQueue.empty())
|
||||
std::unique_lock<std::mutex> trylock(
|
||||
TxQ::debugTxInjectMutex, std::try_to_lock);
|
||||
if (trylock.owns_lock() && !debugTxInjectQueue.empty())
|
||||
{
|
||||
// pop everything
|
||||
for (STTx const& txn : debugTxInjectQueue)
|
||||
{
|
||||
auto txnHash = txn.getTransactionID();
|
||||
app.getHashRouter().setFlags(txnHash, SF_EMITTED | SF_PRIVATE2);
|
||||
|
||||
|
||||
auto const& emitted =
|
||||
const_cast<ripple::STTx&>(txn)
|
||||
.downcast<STObject>();
|
||||
const_cast<ripple::STTx&>(txn).downcast<STObject>();
|
||||
|
||||
auto s = std::make_shared<ripple::Serializer>();
|
||||
emitted.add(*s);
|
||||
|
||||
view.rawTxInsert(
|
||||
txnHash,
|
||||
std::move(s),
|
||||
nullptr);
|
||||
view.rawTxInsert(txnHash, std::move(s), nullptr);
|
||||
ledgerChanged = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -354,11 +354,11 @@ JSS(ident); // in: AccountCurrencies, AccountInfo,
|
||||
JSS(ignore_default); // in: AccountLines
|
||||
JSS(inLedger); // out: tx/Transaction
|
||||
JSS(in_queue);
|
||||
JSS(inbound); // out: PeerImp
|
||||
JSS(index); // in: LedgerEntry, DownloadShard
|
||||
// out: STLedgerEntry,
|
||||
// LedgerEntry, TxHistory, LedgerData
|
||||
JSS(info); // out: ServerInfo, ConsensusInfo, FetchInfo
|
||||
JSS(inbound); // out: PeerImp
|
||||
JSS(index); // in: LedgerEntry, DownloadShard
|
||||
// out: STLedgerEntry,
|
||||
// LedgerEntry, TxHistory, LedgerData
|
||||
JSS(info); // out: ServerInfo, ConsensusInfo, FetchInfo
|
||||
JSS(initial_sync_duration_us);
|
||||
JSS(internal_command); // in: Internal
|
||||
JSS(invalid_API_version); // out: Many, when a request has an invalid
|
||||
|
||||
@@ -40,7 +40,6 @@ getFailHard(RPC::JsonContext const& context)
|
||||
context.params["fail_hard"].asBool());
|
||||
}
|
||||
|
||||
|
||||
// {
|
||||
// tx_blob: serialized tx
|
||||
// }
|
||||
@@ -48,9 +47,11 @@ getFailHard(RPC::JsonContext const& context)
|
||||
Json::Value
|
||||
doInject(RPC::JsonContext& context)
|
||||
{
|
||||
if (!context.params.isMember(jss::tx_blob))
|
||||
return RPC::make_error(
|
||||
rpcINVALID_PARAMS, "Need tx_blob");
|
||||
if (context.role != Role::ADMIN)
|
||||
return RPC::make_error(
|
||||
rpcNOT_SUPPORTED, "Signing is not supported by this server.");
|
||||
if (context.role != Role::ADMIN)
|
||||
return rpcError(rpcNO_PERMISSION);
|
||||
|
||||
Json::Value jvResult;
|
||||
|
||||
@@ -78,11 +79,10 @@ doInject(RPC::JsonContext& context)
|
||||
|
||||
context.app.getTxQ().debugTxInject(*stpTrans);
|
||||
|
||||
|
||||
jvResult[jss::tx_json] = stpTrans->getJson(JsonOptions::none);
|
||||
jvResult[jss::in_queue] = true;
|
||||
|
||||
return jvResult;
|
||||
|
||||
return jvResult;
|
||||
}
|
||||
|
||||
// {
|
||||
|
||||
Reference in New Issue
Block a user