mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Merge branch 'api' of github.com:jedmccaleb/NewCoin
This commit is contained in:
@@ -165,6 +165,8 @@ void Config::setup(const std::string& strConf)
|
||||
|
||||
void Config::load()
|
||||
{
|
||||
std::cout << "Loading: " << CONFIG_FILE << std::endl;
|
||||
|
||||
std::ifstream ifsConfig(CONFIG_FILE.c_str(), std::ios::in);
|
||||
|
||||
if (!ifsConfig)
|
||||
|
||||
@@ -993,7 +993,7 @@ void NetworkOPs::pubLedger(Ledger::ref lpAccepted)
|
||||
|
||||
{
|
||||
boost::interprocess::sharable_lock<boost::interprocess::interprocess_upgradable_mutex> sl(mMonitorLock);
|
||||
bool bAll = !mSubTransaction.empty();
|
||||
bool bAll = !mSubTransactions.empty();
|
||||
bool bAccounts = !mSubAccountTransaction.empty();
|
||||
|
||||
if (bAll || bAccounts)
|
||||
@@ -1069,7 +1069,7 @@ void NetworkOPs::pubTransactionAll(Ledger::ref lpCurrent, const SerializedTransa
|
||||
{
|
||||
Json::Value jvObj = transJson(stTxn, terResult, bAccepted, lpCurrent, "transaction");
|
||||
|
||||
BOOST_FOREACH(InfoSub* ispListener, mSubTransaction)
|
||||
BOOST_FOREACH(InfoSub* ispListener, mSubTransactions)
|
||||
{
|
||||
ispListener->send(jvObj);
|
||||
}
|
||||
@@ -1114,7 +1114,7 @@ void NetworkOPs::pubTransaction(Ledger::ref lpCurrent, const SerializedTransacti
|
||||
{
|
||||
boost::interprocess::sharable_lock<boost::interprocess::interprocess_upgradable_mutex> sl(mMonitorLock);
|
||||
|
||||
if (!mSubTransaction.empty())
|
||||
if (!mSubTransactions.empty())
|
||||
{
|
||||
pubTransactionAll(lpCurrent, stTxn, terResult, false);
|
||||
}
|
||||
@@ -1306,13 +1306,13 @@ bool NetworkOPs::unsubLedgerAccounts(InfoSub* ispListener)
|
||||
// <-- bool: true=added, false=already there
|
||||
bool NetworkOPs::subTransaction(InfoSub* ispListener)
|
||||
{
|
||||
return mSubTransaction.insert(ispListener).second;
|
||||
return mSubTransactions.insert(ispListener).second;
|
||||
}
|
||||
|
||||
// <-- bool: true=erased, false=was not there
|
||||
bool NetworkOPs::unsubTransaction(InfoSub* ispListener)
|
||||
{
|
||||
return !!mSubTransaction.erase(ispListener);
|
||||
return !!mSubTransactions.erase(ispListener);
|
||||
}
|
||||
|
||||
// vim:ts=4
|
||||
|
||||
@@ -72,14 +72,17 @@ protected:
|
||||
|
||||
// XXX Split into more locks.
|
||||
boost::interprocess::interprocess_upgradable_mutex mMonitorLock;
|
||||
subInfoMapType mBootAccountInfo;
|
||||
subInfoMapType mSubAccountInfo;
|
||||
subInfoMapType mSubAccountTransaction;
|
||||
boost::unordered_set<InfoSub*> mSubLedger; // ledger accepteds
|
||||
boost::unordered_set<InfoSub*> mSubLedgerAccounts; // ledger accepteds + affected accounts
|
||||
boost::unordered_set<InfoSub*> mSubTransaction; // all transactions
|
||||
boost::unordered_set<InfoSub*> mSubTxMeta; // all transaction meta
|
||||
// subInfoMapType mSubTransactionAccounts;
|
||||
subInfoMapType mSubAccount;
|
||||
subInfoMapType mSubRTAccount;
|
||||
|
||||
boost::unordered_set<InfoSub*> mSubLedger; // accepted ledgers
|
||||
boost::unordered_set<InfoSub*> mSubLedgerAccounts; // accepted ledgers + affected accounts
|
||||
boost::unordered_set<InfoSub*> mSubTransactions; // all accepted transactions
|
||||
boost::unordered_set<InfoSub*> mSubRTTransactions; // all proposed and accepted transactions
|
||||
|
||||
subInfoMapType mSubAccountTransaction; // DEPRECATED
|
||||
subInfoMapType mBootAccountInfo; // DEPRECATED
|
||||
subInfoMapType mSubAccountInfo; // DEPRECATED
|
||||
|
||||
void setMode(OperatingMode);
|
||||
|
||||
|
||||
@@ -14,6 +14,10 @@ RPCDoor::RPCDoor(boost::asio::io_service& io_service) :
|
||||
Log(lsINFO) << "RPC port: " << theConfig.RPC_IP << " " << theConfig.RPC_PORT << " allow remote: " << theConfig.RPC_ALLOW_REMOTE;
|
||||
startListening();
|
||||
}
|
||||
RPCDoor::~RPCDoor()
|
||||
{
|
||||
Log(lsINFO) << "RPC port: " << theConfig.RPC_IP << " " << theConfig.RPC_PORT << " allow remote: " << theConfig.RPC_ALLOW_REMOTE;
|
||||
}
|
||||
|
||||
void RPCDoor::startListening()
|
||||
{
|
||||
|
||||
@@ -15,4 +15,5 @@ class RPCDoor
|
||||
bool isClientAllowed(const std::string& ip);
|
||||
public:
|
||||
RPCDoor(boost::asio::io_service& io_service);
|
||||
~RPCDoor();
|
||||
};
|
||||
|
||||
@@ -1609,8 +1609,19 @@ Json::Value RPCHandler::doRippleLinesGet(const Json::Value ¶ms)
|
||||
}
|
||||
|
||||
// submit any transaction to the network
|
||||
// submit private_key json
|
||||
Json::Value RPCHandler::doSubmit(const Json::Value& params)
|
||||
{
|
||||
RippleAddress naSeed;
|
||||
std::string txJSON= params[1u].asString();
|
||||
|
||||
if (!naSeed.setSeedGeneric(params[0u].asString()))
|
||||
{
|
||||
return rpcError(rpcBAD_SEED);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// TODO
|
||||
return rpcError(rpcSRC_ACT_MALFORMED);
|
||||
}
|
||||
@@ -2384,6 +2395,7 @@ Json::Value RPCHandler::doCommand(const std::string& command, Json::Value& param
|
||||
{ "ripple_lines_get", &RPCHandler::doRippleLinesGet, 1, 2, false, optCurrent },
|
||||
{ "ripple_line_set", &RPCHandler::doRippleLineSet, 4, 7, false, optCurrent },
|
||||
{ "send", &RPCHandler::doSend, 3, 9, false, optCurrent },
|
||||
{ "submit", &RPCHandler::doSubmit, 2, 2, false, optCurrent },
|
||||
{ "server_info", &RPCHandler::doServerInfo, 0, 0, true },
|
||||
{ "stop", &RPCHandler::doStop, 0, 0, true },
|
||||
{ "tx", &RPCHandler::doTx, 1, 1, true },
|
||||
|
||||
@@ -416,6 +416,8 @@ server : Sends a message anytime the server status changes such as network conne
|
||||
ledger : Sends a message at every ledger close.
|
||||
transactions : Sends a message for every transaction that makes it into a ledger.
|
||||
rt_transactions
|
||||
accounts
|
||||
rt_accounts
|
||||
*/
|
||||
// TODO
|
||||
void WSConnection::doSubscribe(Json::Value& jvResult, const Json::Value& jvRequest)
|
||||
|
||||
Reference in New Issue
Block a user