mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Merge branch 'master' of github.com:jedmccaleb/NewCoin
This commit is contained in:
@@ -901,7 +901,7 @@ Json::Value NetworkOPs::pubBootstrapAccountInfo(Ledger::ref lpAccepted, const Ne
|
|||||||
jvObj["owner"] = getOwnerInfo(lpAccepted, naAccountID);
|
jvObj["owner"] = getOwnerInfo(lpAccepted, naAccountID);
|
||||||
jvObj["ledger_closed_index"] = lpAccepted->getLedgerSeq();
|
jvObj["ledger_closed_index"] = lpAccepted->getLedgerSeq();
|
||||||
jvObj["ledger_closed"] = lpAccepted->getHash().ToString();
|
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;
|
return jvObj;
|
||||||
}
|
}
|
||||||
@@ -939,7 +939,7 @@ void NetworkOPs::pubLedger(Ledger::ref lpAccepted)
|
|||||||
jvObj["type"] = "ledgerClosed";
|
jvObj["type"] = "ledgerClosed";
|
||||||
jvObj["ledger_closed_index"] = lpAccepted->getLedgerSeq();
|
jvObj["ledger_closed_index"] = lpAccepted->getLedgerSeq();
|
||||||
jvObj["ledger_closed"] = lpAccepted->getHash().ToString();
|
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)
|
BOOST_FOREACH(InfoSub* ispListener, mSubLedger)
|
||||||
{
|
{
|
||||||
@@ -964,7 +964,7 @@ void NetworkOPs::pubLedger(Ledger::ref lpAccepted)
|
|||||||
jvObj["type"] = "ledgerClosedAccounts";
|
jvObj["type"] = "ledgerClosedAccounts";
|
||||||
jvObj["ledger_closed_index"] = lpAccepted->getLedgerSeq();
|
jvObj["ledger_closed_index"] = lpAccepted->getLedgerSeq();
|
||||||
jvObj["ledger_closed"] = lpAccepted->getHash().ToString();
|
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;
|
jvObj["accounts"] = jvAccounts;
|
||||||
|
|
||||||
BOOST_FOREACH(InfoSub* ispListener, mSubLedgerAccounts)
|
BOOST_FOREACH(InfoSub* ispListener, mSubLedgerAccounts)
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
#include "PubKeyCache.h"
|
#include "PubKeyCache.h"
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
|
|
||||||
#include <boost/interprocess/sync/scoped_lock.hpp>
|
|
||||||
|
|
||||||
|
|
||||||
CKey::pointer PubKeyCache::locate(const NewcoinAddress& id)
|
CKey::pointer PubKeyCache::locate(const NewcoinAddress& id)
|
||||||
{
|
{
|
||||||
{ // is it in cache
|
{ // is it in cache
|
||||||
|
|||||||
@@ -2046,9 +2046,14 @@ Json::Value RPCServer::doAccountTransactions(const Json::Value& params)
|
|||||||
{
|
{
|
||||||
Transaction::pointer txn = theApp->getMasterTransaction().fetch(it->second, true);
|
Transaction::pointer txn = theApp->getMasterTransaction().fetch(it->second, true);
|
||||||
if (!txn)
|
if (!txn)
|
||||||
|
{
|
||||||
ret["transactions"].append(it->second.GetHex());
|
ret["transactions"].append(it->second.GetHex());
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
txn->setLedger(it->first);
|
||||||
ret["transactions"].append(txn->getJson(0));
|
ret["transactions"].append(txn->getJson(0));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
#include <boost/foreach.hpp>
|
#include <boost/foreach.hpp>
|
||||||
#include <boost/format.hpp>
|
#include <boost/format.hpp>
|
||||||
#include <boost/interprocess/sync/scoped_lock.hpp>
|
|
||||||
#include <boost/lexical_cast.hpp>
|
#include <boost/lexical_cast.hpp>
|
||||||
#include <boost/make_shared.hpp>
|
#include <boost/make_shared.hpp>
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ int iToSeconds(boost::posix_time::ptime ptWhen)
|
|||||||
: (ptWhen-ptEpoch()).total_seconds();
|
: (ptWhen-ptEpoch()).total_seconds();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Convert our time in seconds to a ptime.
|
||||||
boost::posix_time::ptime ptFromSeconds(int iSeconds)
|
boost::posix_time::ptime ptFromSeconds(int iSeconds)
|
||||||
{
|
{
|
||||||
return iSeconds < 0
|
return iSeconds < 0
|
||||||
@@ -29,6 +30,18 @@ boost::posix_time::ptime ptFromSeconds(int iSeconds)
|
|||||||
: ptEpoch() + boost::posix_time::seconds(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
|
// Hex suport
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ extern uint32_t be32toh(uint32_t value);
|
|||||||
boost::posix_time::ptime ptEpoch();
|
boost::posix_time::ptime ptEpoch();
|
||||||
int iToSeconds(boost::posix_time::ptime ptWhen);
|
int iToSeconds(boost::posix_time::ptime ptWhen);
|
||||||
boost::posix_time::ptime ptFromSeconds(int iSeconds);
|
boost::posix_time::ptime ptFromSeconds(int iSeconds);
|
||||||
|
uint64_t utFromSeconds(int iSeconds);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
void intIPtoStr(int ip,std::string& retStr);
|
void intIPtoStr(int ip,std::string& retStr);
|
||||||
|
|||||||
Reference in New Issue
Block a user