diff --git a/src/NetworkOPs.cpp b/src/NetworkOPs.cpp index 34f3304e9..1e6050469 100644 --- a/src/NetworkOPs.cpp +++ b/src/NetworkOPs.cpp @@ -901,7 +901,7 @@ Json::Value NetworkOPs::pubBootstrapAccountInfo(Ledger::ref lpAccepted, const Ne jvObj["owner"] = getOwnerInfo(lpAccepted, naAccountID); jvObj["ledger_closed_index"] = lpAccepted->getLedgerSeq(); jvObj["ledger_closed"] = lpAccepted->getHash().ToString(); - jvObj["time"] = Json::Value::UInt(lpAccepted->getCloseTimeNC()); + jvObj["ledger_closed_time"] = Json::Value::UInt(utFromSeconds(lpAccepted->getCloseTimeNC())); return jvObj; } @@ -939,7 +939,7 @@ void NetworkOPs::pubLedger(Ledger::ref lpAccepted) jvObj["type"] = "ledgerClosed"; jvObj["ledger_closed_index"] = lpAccepted->getLedgerSeq(); jvObj["ledger_closed"] = lpAccepted->getHash().ToString(); - jvObj["time"] = Json::Value::UInt(lpAccepted->getCloseTimeNC()); + jvObj["ledger_closed_time"] = Json::Value::UInt(utFromSeconds(lpAccepted->getCloseTimeNC())); BOOST_FOREACH(InfoSub* ispListener, mSubLedger) { @@ -964,7 +964,7 @@ void NetworkOPs::pubLedger(Ledger::ref lpAccepted) jvObj["type"] = "ledgerClosedAccounts"; jvObj["ledger_closed_index"] = lpAccepted->getLedgerSeq(); jvObj["ledger_closed"] = lpAccepted->getHash().ToString(); - jvObj["time"] = Json::Value::UInt(lpAccepted->getCloseTimeNC()); + jvObj["ledger_closed_time"] = Json::Value::UInt(utFromSeconds(lpAccepted->getCloseTimeNC())); jvObj["accounts"] = jvAccounts; BOOST_FOREACH(InfoSub* ispListener, mSubLedgerAccounts) diff --git a/src/PubKeyCache.cpp b/src/PubKeyCache.cpp index 4ca514039..8d11c74c5 100644 --- a/src/PubKeyCache.cpp +++ b/src/PubKeyCache.cpp @@ -1,9 +1,6 @@ #include "PubKeyCache.h" #include "Application.h" -#include - - CKey::pointer PubKeyCache::locate(const NewcoinAddress& id) { { // is it in cache diff --git a/src/RPCServer.cpp b/src/RPCServer.cpp index 096c20846..1c88bb208 100644 --- a/src/RPCServer.cpp +++ b/src/RPCServer.cpp @@ -2046,9 +2046,14 @@ Json::Value RPCServer::doAccountTransactions(const Json::Value& params) { Transaction::pointer txn = theApp->getMasterTransaction().fetch(it->second, true); if (!txn) + { ret["transactions"].append(it->second.GetHex()); + } else + { + txn->setLedger(it->first); ret["transactions"].append(txn->getJson(0)); + } } return ret; diff --git a/src/Wallet.cpp b/src/Wallet.cpp index f5670eda7..ab9c866ef 100644 --- a/src/Wallet.cpp +++ b/src/Wallet.cpp @@ -6,7 +6,6 @@ #include #include -#include #include #include diff --git a/src/utils.cpp b/src/utils.cpp index 979381c2c..9734e5974 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -22,6 +22,7 @@ int iToSeconds(boost::posix_time::ptime ptWhen) : (ptWhen-ptEpoch()).total_seconds(); } +// Convert our time in seconds to a ptime. boost::posix_time::ptime ptFromSeconds(int iSeconds) { return iSeconds < 0 @@ -29,6 +30,18 @@ boost::posix_time::ptime ptFromSeconds(int iSeconds) : ptEpoch() + boost::posix_time::seconds(iSeconds); } +// Convert from our time to UNIX time in seconds. +uint64_t utFromSeconds(int iSeconds) +{ + boost::posix_time::time_duration tdDelta = + boost::posix_time::ptime(boost::gregorian::date(2000, boost::gregorian::Jan, 1)) + -boost::posix_time::ptime(boost::gregorian::date(1970, boost::gregorian::Jan, 1)) + +boost::posix_time::seconds(iSeconds) + ; + + return tdDelta.total_seconds(); +} + // // Hex suport // diff --git a/src/utils.h b/src/utils.h index 5dd420805..8efdef451 100644 --- a/src/utils.h +++ b/src/utils.h @@ -90,6 +90,7 @@ extern uint32_t be32toh(uint32_t value); boost::posix_time::ptime ptEpoch(); int iToSeconds(boost::posix_time::ptime ptWhen); boost::posix_time::ptime ptFromSeconds(int iSeconds); +uint64_t utFromSeconds(int iSeconds); /* void intIPtoStr(int ip,std::string& retStr);