diff --git a/src/RPCServer.cpp b/src/RPCServer.cpp index 0723e7936..798dd0c1a 100644 --- a/src/RPCServer.cpp +++ b/src/RPCServer.cpp @@ -1314,11 +1314,9 @@ Json::Value RPCServer::doPeers(const Json::Value& params) return obj; } -// profile offers [submit] -// profile 0:offers 1:pass_a 2:account_a 3:currency_offer_a 4:pass_b 5:account_b 6:currency_offer_b 7: 8:[submit] +// profile offers [submit] +// profile 0:offers 1:pass_a 2:account_a 3:currency_offer_a 4:account_b 5:currency_offer_b 6: 7:[submit] // issuer is the offering account -// the amount of each offer will be 1. -// --> count: defaults to 100, does 2 offers per iteration. // --> submit: 'submit|true|false': defaults to false // Prior to running allow each to have a credit line of what they will be getting from the other account. Json::Value RPCServer::doProfile(const Json::Value ¶ms) @@ -1333,7 +1331,7 @@ Json::Value RPCServer::doProfile(const Json::Value ¶ms) uint32 iCount = 100; bool bSubmit = false; - if (iArgs < 7 || "offers" != params[0u].asString()) + if (iArgs < 6 || "offers" != params[0u].asString()) { return RPCError(rpcINVALID_PARAMS); } @@ -1346,27 +1344,27 @@ Json::Value RPCServer::doProfile(const Json::Value ¶ms) if (!STAmount::currencyFromString(uCurrencyOfferA, params[3u].asString())) // return RPCError(rpcINVALID_PARAMS); - if (!naSeedB.setSeedGeneric(params[4u].asString())) // + naAccountB.setAccountID(params[4u].asString()); // + if (!STAmount::currencyFromString(uCurrencyOfferB, params[5u].asString())) // return RPCError(rpcINVALID_PARAMS); - naAccountB.setAccountID(params[5u].asString()); // - if (!STAmount::currencyFromString(uCurrencyOfferB, params[6u].asString())) // - return RPCError(rpcINVALID_PARAMS); + iCount = lexical_cast_s(params[6u].asString()); - if (iArgs >= 8) - iCount = lexical_cast_s(params[7u].asString()); - - if (iArgs >= 9 && "false" != params[8u].asString()) + if (iArgs >= 8 && "false" != params[7u].asString()) bSubmit = true; + Log::setMinSeverity(lsFATAL); + boost::posix_time::ptime ptStart(boost::posix_time::microsec_clock::local_time()); - for (int i = iCount; i-- >= 0;) { + for(int n=0; nsubmitTransaction(tpOfferA); - - NewcoinAddress naMasterGeneratorB; - NewcoinAddress naAccountPublicB; - NewcoinAddress naAccountPrivateB; - AccountState::pointer asSrcB; - STAmount saSrcBalanceB; - Json::Value jvObjB = authorize(uint256(0), naSeedB, naAccountB, naAccountPublicB, naAccountPrivateB, - saSrcBalanceB, theConfig.FEE_DEFAULT, asSrcB, naMasterGeneratorB); - - if (!jvObjB.empty()) - return jvObjB; - - Transaction::pointer tpOfferB = Transaction::sharedOfferCreate( - naAccountPublicB, naAccountPrivateB, - naAccountB, // naSourceAccount, - asSrcB->getSeq(), // uSeq - theConfig.FEE_DEFAULT, - 0, // uSourceTag, - false, // bPassive - STAmount(uCurrencyOfferB, naAccountB.getAccountID(), 1), // saTakerPays - STAmount(uCurrencyOfferA, naAccountA.getAccountID(), 1), // saTakerGets - 0); // uExpiration - - if (bSubmit) - tpOfferB = mNetOps->submitTransaction(tpOfferB); } boost::posix_time::ptime ptEnd(boost::posix_time::microsec_clock::local_time()); boost::posix_time::time_duration tdInterval = ptEnd-ptStart; long lMicroseconds = tdInterval.total_microseconds(); - int iTransactions = iCount*2; + int iTransactions = iCount; float fRate = lMicroseconds ? iTransactions/(lMicroseconds/1000000.0) : 0.0; Json::Value obj(Json::objectValue);