Merge branch 'develop' of github.com:jedmccaleb/NewCoin into develop

This commit is contained in:
Arthur Britto
2013-05-06 20:14:04 -07:00
18 changed files with 3031 additions and 2897 deletions

View File

@@ -1164,10 +1164,10 @@ STAmount STAmount::deserialize(SerializerIterator& it)
std::string STAmount::getFullText() const std::string STAmount::getFullText() const
{ {
static boost::format nativeFormat("%s/" SYSTEM_CURRENCY_CODE); static const boost::format nativeFormat("%s/" SYSTEM_CURRENCY_CODE);
static boost::format noIssuer("%s/%s/0"); static const boost::format noIssuer("%s/%s/0");
static boost::format issuerOne("%s/%s/1"); static const boost::format issuerOne("%s/%s/1");
static boost::format normal("%s/%s/%s"); static const boost::format normal("%s/%s/%s");
if (mIsNative) if (mIsNative)
{ {
return str(boost::format(nativeFormat) % getText()); return str(boost::format(nativeFormat) % getText());

View File

@@ -191,6 +191,9 @@ int PFRequest::parseJson(const Json::Value& jvParams, bool complete)
} }
} }
if (jvParams.isMember("id"))
jvId = jvParams["id"];
return ret; return ret;
} }
Json::Value PFRequest::doClose(const Json::Value&) Json::Value PFRequest::doClose(const Json::Value&)
@@ -234,6 +237,10 @@ bool PFRequest::doUpdate(RLCache::ref cache, bool fast)
jvStatus["source_account"] = raSrcAccount.humanAccountID(); jvStatus["source_account"] = raSrcAccount.humanAccountID();
jvStatus["destination_account"] = raDstAccount.humanAccountID(); jvStatus["destination_account"] = raDstAccount.humanAccountID();
jvStatus["destination_amount"] = saDstAmount.getJson(0);
if (!jvId.isNull())
jvStatus["id"] = jvId;
Json::Value jvArray = Json::arrayValue; Json::Value jvArray = Json::arrayValue;

View File

@@ -42,6 +42,7 @@ public:
protected: protected:
boost::recursive_mutex mLock; boost::recursive_mutex mLock;
boost::weak_ptr<InfoSub> wpSubscriber; // Who this request came from boost::weak_ptr<InfoSub> wpSubscriber; // Who this request came from
Json::Value jvId;
Json::Value jvStatus; // Last result Json::Value jvStatus; // Last result
// Client request parameters // Client request parameters

View File

@@ -131,6 +131,7 @@ template<typename c_Key, typename c_Data> int TaggedCache<c_Key, c_Data>::getTra
template<typename c_Key, typename c_Data> void TaggedCache<c_Key, c_Data>::clear() template<typename c_Key, typename c_Data> void TaggedCache<c_Key, c_Data>::clear()
{ {
boost::recursive_mutex::scoped_lock sl(mLock);
mCache.clear(); mCache.clear();
mCacheCount = 0; mCacheCount = 0;
} }

View File

@@ -3,14 +3,68 @@
#include "TransactionEngine.h" #include "TransactionEngine.h"
// Double check a transaction's metadata to make sure no system invariants were broken // Double check a transaction's metadata to make sure no system invariants were broken
// Call right before 'calcRawMeta'
SETUP_LOG();
bool TransactionEngine::checkInvariants(TER result, const SerializedTransaction& txn, TransactionEngineParams params) bool TransactionEngine::checkInvariants(TER result, const SerializedTransaction& txn, TransactionEngineParams params)
{ {
const RippleAddress& srcAccount = txn.getFieldAccount(sfAccount);
uint32 txnSeq = txn.getFieldU32(sfSequence);
// 1) Make sure transaction changed account sequence number to correct value LedgerEntryAction leaAction;
// 2) Make sure transaction didn't create XRP uint256 srcActId = Ledger::getAccountRootIndex(srcAccount.getAccountID());
SLE::pointer origSrcAct = mLedger->getSLE(srcActId);
SLE::pointer newSrcAct = mNodes.getEntry(srcActId, leaAction);
if (!newSrcAct || !origSrcAct)
{
cLog(lsFATAL) << "Transaction created or destroyed its issuing account";
assert(false);
return tefINTERNAL;
}
if ((newSrcAct->getFieldU32(sfSequence) != (txnSeq + 1)) ||
(origSrcAct->getFieldU32(sfSequence) != txnSeq))
{
cLog(lsFATAL) << "Transaction mangles sequence numbers";
cLog(lsFATAL) << "t:" << txnSeq << " o: " << origSrcAct->getFieldU32(sfSequence)
<< " n: " << newSrcAct->getFieldU32(sfSequence);
assert(false);
return tefINTERNAL;
}
int64 xrpChange = txn.getFieldAmount(sfFee).getSNValue();
for (LedgerEntrySet::const_iterator it = mNodes.begin(), end = mNodes.end(); it != end; ++it)
{
const LedgerEntrySetEntry& entry = it->second;
if (entry.mAction == taaMODIFY)
{
#if 0
if (entry.mEntry->getType() == ltRIPPLE_STATE)
{
// if this transaction pushes a ripple state over its limit, make sure it also modifies
// an offer placed by that same user
}
#endif
if (entry.mEntry->getType() == ltACCOUNT_ROOT)
{ // account modified
xrpChange += entry.mEntry->getFieldAmount(sfBalance).getSNValue();
xrpChange -= mLedger->getSLE(it->first)->getFieldAmount(sfBalance).getSNValue();
}
}
else if (entry.mAction == taaCREATE)
{
if (entry.mEntry->getType() == ltACCOUNT_ROOT) // account created
xrpChange += entry.mEntry->getFieldAmount(sfBalance).getSNValue();
}
}
if (xrpChange != 0)
{
cLog(lsFATAL) << "Transaction creates/destroys XRP";
assert(false);
return tefINTERNAL;
}
return true; return true;
} }

18
src/cpp/websocketpp/.gitattributes vendored Normal file
View File

@@ -0,0 +1,18 @@
# Lineendings
*.sln eol=crlf
*.vcproj eol=crlf
*.vcxproj* eol=crfl
# Whitespace rules
# strict (no trailing, no tabs)
*.cpp whitespace=trailing-space,space-before-tab,tab-in-indent,cr-at-eol
*.hpp whitespace=trailing-space,space-before-tab,tab-in-indent,cr-at-eol
*.c whitespace=trailing-space,space-before-tab,tab-in-indent,cr-at-eol
*.h whitespace=trailing-space,space-before-tab,tab-in-indent,cr-at-eol
# normal (no trailing)
*.sql whitespace=trailing-space,space-before-tab,cr-at-eol
*.txt whitespace=trailing-space,space-before-tab,cr-at-eol
# special files which must ignore whitespace
*.patch whitespace=-trailing-space

53
src/cpp/websocketpp/.gitignore vendored Normal file
View File

@@ -0,0 +1,53 @@
# make .git* files visible to git
!.gitignore
!.gitattributes
.DS_Store
#vim stuff
*~
*.swp
*.o
*.so
*.so.?
*.so.?.?.?
*.a
*.dylib
objs_shared/
objs_static/
examples/chat_server/chat_server
examples/echo_server/echo_server
examples/chat_client/chat_client
examples/echo_client/echo_client
test/basic/tests
libwebsocketpp.dylib.0.1.0
websocketpp.xcodeproj/xcuserdata/*
websocketpp.xcodeproj/project.xcworkspace/xcuserdata/*
policy_based_notes.hpp
examples/echo_server_tls/echo_server_tls
examples/fuzzing_client/fuzzing_client
examples/stress_client/stress_client
examples/broadcast_server_tls/broadcast_server
test/basic/perf
examples/echo_server_tls/echo_server_tls
examples/concurrent_server/concurrent_server
examples/fuzzing_server_tls/fuzzing_server
examples/wsperf/wsperf
.sconsign.dblite
build/
examples/wsperf/wsperf_client