diff --git a/.gitignore b/.gitignore index 793d90cba..d9b3fdee9 100644 --- a/.gitignore +++ b/.gitignore @@ -25,4 +25,4 @@ node_modules tmp # Ignore database directory. -db/*.db \ No newline at end of file +db/*.db diff --git a/js/remote.js b/js/remote.js index 04d048153..73c199705 100644 --- a/js/remote.js +++ b/js/remote.js @@ -14,9 +14,6 @@ // instances of this class for network access. // -// Node -var util = require('util'); - // npm var WebSocket = require('ws'); @@ -317,7 +314,7 @@ Remote.prototype._connect_start = function () { // with self-signed certs as the user must have pre-approved the self-signed certs. var self = this; - var url = util.format("ws://%s:%s", this.websocket_ip, this.websocket_port); + var url = "ws://" + this.websocket_ip + ":" + this.websocket_port; if (this.trace) console.log("remote: connect: %s", url); diff --git a/src/Amount.cpp b/src/Amount.cpp index 8f2249171..40639d164 100644 --- a/src/Amount.cpp +++ b/src/Amount.cpp @@ -892,8 +892,16 @@ STAmount STAmount::multiply(const STAmount& v1, const STAmount& v2, const uint16 if (v1.isZero() || v2.isZero()) return STAmount(uCurrencyID, uIssuerID); - if (v1.mIsNative && v2.mIsNative) // FIXME: overflow - return STAmount(v1.getFName(), v1.getSNValue() * v2.getSNValue()); + if (v1.mIsNative && v2.mIsNative) + { + uint64 minV = (v1.getSNValue() < v2.getSNValue()) ? v1.getSNValue() : v2.getSNValue(); + uint64 maxV = (v1.getSNValue() < v2.getSNValue()) ? v2.getSNValue() : v1.getSNValue(); + if (minV > 3000000000) // sqrt(cMaxNative) + throw std::runtime_error("Native value overflow"); + if (((maxV >> 32) * minV) > 2095475792) // cMaxNative / 2^32 + throw std::runtime_error("Native value overflow"); + return STAmount(v1.getFName(), minV * maxV); + } uint64 value1 = v1.mValue, value2 = v2.mValue; int offset1 = v1.mOffset, offset2 = v2.mOffset; diff --git a/src/NetworkOPs.cpp b/src/NetworkOPs.cpp index e00b086df..56faaba9e 100644 --- a/src/NetworkOPs.cpp +++ b/src/NetworkOPs.cpp @@ -906,6 +906,23 @@ Json::Value NetworkOPs::getServerInfo() if (mConsensus) info["consensus"] = mConsensus->getJson(); + typedef std::pair jt_int_pair; + bool anyJobs = false; + Json::Value jobs = Json::arrayValue; + std::vector< std::pair > jobCounts = theApp->getJobQueue().getJobCounts(); + BOOST_FOREACH(jt_int_pair& it, jobCounts) + { + if (it.second != 0) + { + Json::Value o = Json::objectValue; + o[Job::toString(it.first)] = it.second; + jobs.append(o); + anyJobs = true; + } + } + if (anyJobs) + info["jobs"] = jobs; + return info; } diff --git a/src/SHAMap.h b/src/SHAMap.h index 6acadf667..7adc92bc2 100644 --- a/src/SHAMap.h +++ b/src/SHAMap.h @@ -259,7 +259,7 @@ protected: public: SHAMapMissingNode(SHAMapType t, const SHAMapNode& nodeID, const uint256& nodeHash) : - std::runtime_error(nodeID.getString()), mType(t), mNodeID(nodeID), mNodeHash(nodeHash) + std::runtime_error("SHAMapMissingNode"), mType(t), mNodeID(nodeID), mNodeHash(nodeHash) { ; } SHAMapMissingNode(SHAMapType t, const SHAMapNode& nodeID, const uint256& nodeHash, const uint256& targetIndex) : diff --git a/src/SHAMapNodes.cpp b/src/SHAMapNodes.cpp index 0d4f134c4..f4caccb8b 100644 --- a/src/SHAMapNodes.cpp +++ b/src/SHAMapNodes.cpp @@ -18,10 +18,12 @@ std::string SHAMapNode::getString() const { + static boost::format NodeID("NodeID(%s,%s)"); + if ((mDepth == 0) && (mNodeID.isZero())) return "NodeID(root)"; - return str(boost::format("NodeID(%s,%s)") + return str(NodeID % boost::lexical_cast(mDepth) % mNodeID.GetHex()); } diff --git a/src/TransactionMaster.cpp b/src/TransactionMaster.cpp index e260ccde2..196845bfd 100644 --- a/src/TransactionMaster.cpp +++ b/src/TransactionMaster.cpp @@ -58,8 +58,8 @@ bool TransactionMaster::canonicalize(Transaction::pointer& txn, bool may_be_new) uint256 tid = txn->getID(); if (!tid) return false; if (mCache.canonicalize(tid, txn)) return true; - if (may_be_new) // FIXME: Don't dispatch to main pool - theApp->getIOService().post(boost::bind(&Transaction::saveTransaction, txn)); + if (may_be_new) + theApp->getAuxService().post(boost::bind(&Transaction::saveTransaction, txn)); return false; } // vim:ts=4