Merge branch 'master' into continuousClose

This commit is contained in:
JoelKatz
2012-06-30 16:32:38 -07:00
12 changed files with 182 additions and 86 deletions

View File

@@ -369,10 +369,15 @@ bool NetworkOPs::checkLastClosedLedger(const std::vector<Peer::pointer>& peerLis
}
Ledger::pointer ourClosed = mLedgerMaster->getClosedLedger();
uint256 closedLedger = ourClosed->getHash();
ValidationCount& ourVC = ledgers[closedLedger];
++ourVC.nodesUsing;
ourVC.highNode = theApp->getWallet().getNodePublic();
uint256 closedLedger=0;
if(theConfig.LEDGER_CREATOR || ourClosed->getLedgerSeq() > 100)
{
closedLedger = ourClosed->getHash();
ValidationCount& ourVC = ledgers[closedLedger];
++ourVC.nodesUsing;
ourVC.highNode = theApp->getWallet().getNodePublic();
}
for (std::vector<Peer::pointer>::const_iterator it = peerList.begin(), end = peerList.end(); it != end; ++it)
{
@@ -765,17 +770,31 @@ void NetworkOPs::pubLedger(const Ledger::pointer& lpAccepted)
}
}
Json::Value NetworkOPs::transJson(const SerializedTransaction& stTxn, TransactionEngineResult terResult, const std::string& strStatus, int iSeq, const std::string& strType)
{
Json::Value jvObj(Json::objectValue);
std::string strToken;
std::string strHuman;
transResultInfo(terResult, strToken, strHuman);
jvObj["type"] = strType;
jvObj["transaction"] = stTxn.getJson(0);
jvObj["transaction"]["inLedger"] = iSeq;
jvObj["transaction"]["status"] = strStatus;
jvObj["result"] = strToken;
jvObj["result_code"] = terResult;
return jvObj;
}
void NetworkOPs::pubTransaction(const Ledger::pointer& lpCurrent, const SerializedTransaction& stTxn, TransactionEngineResult terResult)
{
{
boost::interprocess::sharable_lock<boost::interprocess::interprocess_upgradable_mutex> sl(mMonitorLock);
if (!mSubTransaction.empty())
{
Json::Value jvObj(Json::objectValue);
jvObj["type"] = "transactionProposed";
jvObj["seq"] = lpCurrent->getLedgerSeq();
jvObj["transaction"] = stTxn.getJson(0);
Json::Value jvObj = transJson(stTxn, terResult, "proposed", lpCurrent->getLedgerSeq(), "transaction");
BOOST_FOREACH(InfoSub* ispListener, mSubTransaction)
{
@@ -808,19 +827,7 @@ void NetworkOPs::pubTransaction(const Ledger::pointer& lpCurrent, const Serializ
if (!usisNotify.empty())
{
Json::Value jvAccounts(Json::arrayValue);
BOOST_FOREACH(const NewcoinAddress& naAccountID, stTxn.getAffectedAccounts())
{
jvAccounts.append(Json::Value(naAccountID.humanAccountID()));
}
Json::Value jvObj(Json::objectValue);
jvObj["type"] = "accountTransactionProposed";
jvObj["seq"] = lpCurrent->getLedgerSeq();
jvObj["accounts"] = jvAccounts;
jvObj["transaction"] = stTxn.getJson(0);
Json::Value jvObj = transJson(stTxn, terResult, "proposed", lpCurrent->getLedgerSeq(), "account");
BOOST_FOREACH(InfoSub* ispListener, usisNotify)
{