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