mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-20 11:05:54 +00:00
Add some Validators RPC commands
This commit is contained in:
@@ -308,26 +308,23 @@ public:
|
||||
// Return the current ChosenList as JSON
|
||||
Json::Value rpcPrint (Json::Value const& args)
|
||||
{
|
||||
Json::Value result;
|
||||
ChosenList::Ptr list (m_chosenList);
|
||||
Json::Value result (Json::objectValue);
|
||||
|
||||
if (! list.empty())
|
||||
{
|
||||
Json::Value entries (result["chosen_list"]);
|
||||
std::size_t i (1);
|
||||
Json::Value entries (Json::arrayValue);
|
||||
ChosenList::Ptr list (m_chosenList);
|
||||
for (ChosenList::MapType::const_iterator iter (list->map().begin());
|
||||
iter != list->map().end(); ++iter)
|
||||
{
|
||||
Json::Value entry (Json::objectValue);
|
||||
/*
|
||||
ChosenList::MapType::key_type const& key (iter->first);
|
||||
ChosenList::MapType::mapped_type const& value (iter->second);
|
||||
entries[i] = i;
|
||||
++i;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
result ["chosen_list"] = "empty";
|
||||
entry ["key"] = key;
|
||||
entry ["value"] = value;
|
||||
*/
|
||||
entries.append (entry);
|
||||
}
|
||||
result ["chosen_list"] = entries;
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -335,8 +332,20 @@ public:
|
||||
// Returns the list of sources
|
||||
Json::Value rpcSources (Json::Value const& arg)
|
||||
{
|
||||
Json::Value result;
|
||||
Json::Value sources (result ["validators_sources"]);
|
||||
Json::Value result (Json::objectValue);
|
||||
|
||||
Json::Value entries (Json::arrayValue);
|
||||
SharedState::ConstAccess state (m_state);
|
||||
for (SourcesType::const_iterator iter (state->sources.begin());
|
||||
iter != state->sources.end(); ++iter)
|
||||
{
|
||||
Json::Value entry (Json::objectValue);
|
||||
SourceDesc const& desc (*iter);
|
||||
entry ["name"] = desc.source->name();
|
||||
entry ["param"] = desc.source->createParam();
|
||||
entries.append (entry);
|
||||
}
|
||||
result ["sources"] = entries;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -4,10 +4,6 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef RIPPLE_VALIDATORS_DISABLE_MANAGER
|
||||
#define RIPPLE_VALIDATORS_DISABLE_MANAGER 1
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
||||
Information to track:
|
||||
@@ -193,25 +189,28 @@ public:
|
||||
|
||||
void addSource (Source* source)
|
||||
{
|
||||
#if RIPPLE_VALIDATORS_DISABLE_MANAGER
|
||||
delete source;
|
||||
#else
|
||||
#if RIPPLE_USE_NEW_VALIDATORS
|
||||
bassert (! isStopping());
|
||||
m_thread.call (&Logic::add, &m_logic, source);
|
||||
#else
|
||||
delete source;
|
||||
#endif
|
||||
}
|
||||
|
||||
void addStaticSource (Source* source)
|
||||
{
|
||||
#if RIPPLE_VALIDATORS_DISABLE_MANAGER
|
||||
delete source;
|
||||
#else
|
||||
#if RIPPLE_USE_NEW_VALIDATORS
|
||||
bassert (! isStopping());
|
||||
m_thread.call (&Logic::addStatic, &m_logic, source);
|
||||
#else
|
||||
delete source;
|
||||
#endif
|
||||
}
|
||||
|
||||
void receiveValidation (ReceivedValidation const& rv)
|
||||
{
|
||||
#if RIPPLE_USE_NEW_VALIDATORS
|
||||
if (! isStopping())
|
||||
m_thread.call (&Logic::receiveValidation, &m_logic, rv);
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user