diff --git a/newcoin.vcxproj b/newcoin.vcxproj index ba0b2c1b94..1891a5d7a3 100644 --- a/newcoin.vcxproj +++ b/newcoin.vcxproj @@ -150,7 +150,6 @@ - diff --git a/newcoin.vcxproj.filters b/newcoin.vcxproj.filters index 848af1e545..064de313cd 100644 --- a/newcoin.vcxproj.filters +++ b/newcoin.vcxproj.filters @@ -198,9 +198,6 @@ Source Files - - Source Files - Source Files diff --git a/src/cpp/ripple/AccountSetTransactor.h b/src/cpp/ripple/AccountSetTransactor.h index c9f921766f..214a32d27b 100644 --- a/src/cpp/ripple/AccountSetTransactor.h +++ b/src/cpp/ripple/AccountSetTransactor.h @@ -3,7 +3,7 @@ class AccountSetTransactor : public Transactor { public: - AccountSetTransactor(const SerializedTransaction& txn,TransactionEngineParams params, TransactionEngine::pointer engine) : Transactor(txn,params,engine) {} + AccountSetTransactor(const SerializedTransaction& txn,TransactionEngineParams params, TransactionEngine* engine) : Transactor(txn,params,engine) {} TER doApply(); }; \ No newline at end of file diff --git a/src/cpp/ripple/OfferCancelTransactor.h b/src/cpp/ripple/OfferCancelTransactor.h index 750db4625b..8ddd6a5c1b 100644 --- a/src/cpp/ripple/OfferCancelTransactor.h +++ b/src/cpp/ripple/OfferCancelTransactor.h @@ -3,7 +3,7 @@ class OfferCancelTransactor : public Transactor { public: - OfferCancelTransactor(const SerializedTransaction& txn,TransactionEngineParams params, TransactionEngine::pointer engine) : Transactor(txn,params,engine) {} + OfferCancelTransactor(const SerializedTransaction& txn,TransactionEngineParams params, TransactionEngine* engine) : Transactor(txn,params,engine) {} TER doApply(); }; \ No newline at end of file diff --git a/src/cpp/ripple/OfferCreateTransactor.h b/src/cpp/ripple/OfferCreateTransactor.h index 8312ef5a31..02db25ca6e 100644 --- a/src/cpp/ripple/OfferCreateTransactor.h +++ b/src/cpp/ripple/OfferCreateTransactor.h @@ -14,7 +14,7 @@ class OfferCreateTransactor : public Transactor STAmount& saTakerGot); public: - OfferCreateTransactor(const SerializedTransaction& txn,TransactionEngineParams params, TransactionEngine::pointer engine) : Transactor(txn,params,engine) {} + OfferCreateTransactor(const SerializedTransaction& txn,TransactionEngineParams params, TransactionEngine* engine) : Transactor(txn,params,engine) {} TER doApply(); }; diff --git a/src/cpp/ripple/PaymentTransactor.h b/src/cpp/ripple/PaymentTransactor.h index b0f19f29e8..2c93ea713c 100644 --- a/src/cpp/ripple/PaymentTransactor.h +++ b/src/cpp/ripple/PaymentTransactor.h @@ -5,7 +5,7 @@ class PaymentTransactor : public Transactor { void calculateFee(); public: - PaymentTransactor(const SerializedTransaction& txn,TransactionEngineParams params, TransactionEngine::pointer engine) : Transactor(txn,params,engine) {} + PaymentTransactor(const SerializedTransaction& txn,TransactionEngineParams params, TransactionEngine* engine) : Transactor(txn,params,engine) {} TER doApply(); }; \ No newline at end of file diff --git a/src/cpp/ripple/RegularKeySetTransactor.h b/src/cpp/ripple/RegularKeySetTransactor.h index 9e450bd310..a6df0b3569 100644 --- a/src/cpp/ripple/RegularKeySetTransactor.h +++ b/src/cpp/ripple/RegularKeySetTransactor.h @@ -4,7 +4,7 @@ class RegularKeySetTransactor : public Transactor { void calculateFee(); public: - RegularKeySetTransactor(const SerializedTransaction& txn,TransactionEngineParams params, TransactionEngine::pointer engine) : Transactor(txn,params,engine) {} + RegularKeySetTransactor(const SerializedTransaction& txn,TransactionEngineParams params, TransactionEngine* engine) : Transactor(txn,params,engine) {} TER checkFee(); TER checkSig(); TER doApply(); diff --git a/src/cpp/ripple/TransactionEngine.cpp b/src/cpp/ripple/TransactionEngine.cpp index 64c04d7f03..faffb090d3 100644 --- a/src/cpp/ripple/TransactionEngine.cpp +++ b/src/cpp/ripple/TransactionEngine.cpp @@ -4,6 +4,7 @@ #include #include +#include #include "TransactionEngine.h" #include "Transactor.h" @@ -89,7 +90,7 @@ TER TransactionEngine::applyTransaction(const SerializedTransaction& txn, Transa } #endif - Transactor::pointer transactor=Transactor::makeTransactor(txn,params,shared_from_this()); + Transactor::pointer transactor=Transactor::makeTransactor(txn,params,this); if(transactor) { uint256 txID = txn.getTransactionID(); diff --git a/src/cpp/ripple/TransactionEngine.h b/src/cpp/ripple/TransactionEngine.h index 4c92ac2f39..67d9706794 100644 --- a/src/cpp/ripple/TransactionEngine.h +++ b/src/cpp/ripple/TransactionEngine.h @@ -36,7 +36,7 @@ enum TransactionEngineParams // One instance per ledger. // Only one transaction applied at a time. -class TransactionEngine : public boost::enable_shared_from_this, private IS_INSTANCE(TransactionEngine) +class TransactionEngine : private IS_INSTANCE(TransactionEngine) { private: LedgerEntrySet mNodes; diff --git a/src/cpp/ripple/Transactor.cpp b/src/cpp/ripple/Transactor.cpp index 40e6faa397..4878ea406c 100644 --- a/src/cpp/ripple/Transactor.cpp +++ b/src/cpp/ripple/Transactor.cpp @@ -9,15 +9,9 @@ #include "OfferCreateTransactor.h" #include "TrustSetTransactor.h" - SETUP_LOG(); - - - - - -Transactor::pointer Transactor::makeTransactor(const SerializedTransaction& txn,TransactionEngineParams params, TransactionEngine::pointer engine) +Transactor::pointer Transactor::makeTransactor(const SerializedTransaction& txn,TransactionEngineParams params, TransactionEngine* engine) { switch(txn.getTxnType()) { @@ -41,7 +35,7 @@ Transactor::pointer Transactor::makeTransactor(const SerializedTransaction& txn, } -Transactor::Transactor(const SerializedTransaction& txn,TransactionEngineParams params, TransactionEngine::pointer engine) : mTxn(txn), mParams(params), mEngine(engine) +Transactor::Transactor(const SerializedTransaction& txn,TransactionEngineParams params, TransactionEngine* engine) : mTxn(txn), mParams(params), mEngine(engine) { mHasAuthKey=false; } @@ -189,10 +183,6 @@ TER Transactor::apply() if(terResult != tesSUCCESS) return(terResult); calculateFee(); - - terResult=payFee(); - if(terResult != tesSUCCESS) return(terResult); - boost::recursive_mutex::scoped_lock sl(mEngine->getLedger()->mLock); @@ -201,10 +191,6 @@ TER Transactor::apply() // Find source account // If are only forwarding, due to resource limitations, we might verifying only some transactions, this would be probabilistic. - STAmount saSrcBalance; - - - if (!mTxnAccount) { cLog(lsTRACE) << boost::str(boost::format("applyTransaction: Delay transaction: source account does not exist: %s") % @@ -218,6 +204,9 @@ TER Transactor::apply() mHasAuthKey = mTxnAccount->isFieldPresent(sfAuthorizedKey); } + terResult=payFee(); + if(terResult != tesSUCCESS) return(terResult); + terResult=checkSig(); if(terResult != tesSUCCESS) return(terResult); diff --git a/src/cpp/ripple/Transactor.h b/src/cpp/ripple/Transactor.h index 20b8821f0c..88a1a6764b 100644 --- a/src/cpp/ripple/Transactor.h +++ b/src/cpp/ripple/Transactor.h @@ -10,7 +10,7 @@ class Transactor { protected: const SerializedTransaction& mTxn; - TransactionEngine::pointer mEngine; + TransactionEngine* mEngine; TransactionEngineParams mParams; uint160 mTxnAccountID; @@ -28,12 +28,12 @@ protected: virtual TER checkSig(); virtual TER doApply()=0; - Transactor(const SerializedTransaction& txn, TransactionEngineParams params, TransactionEngine::pointer engine); + Transactor(const SerializedTransaction& txn, TransactionEngineParams params, TransactionEngine* engine); public: typedef boost::shared_ptr pointer; - static Transactor::pointer makeTransactor(const SerializedTransaction& txn,TransactionEngineParams params, TransactionEngine::pointer engine); + static Transactor::pointer makeTransactor(const SerializedTransaction& txn,TransactionEngineParams params, TransactionEngine* engine); TER apply(); }; diff --git a/src/cpp/ripple/TrustSetTransactor.h b/src/cpp/ripple/TrustSetTransactor.h index b801768fe8..69b09aa016 100644 --- a/src/cpp/ripple/TrustSetTransactor.h +++ b/src/cpp/ripple/TrustSetTransactor.h @@ -3,7 +3,7 @@ class TrustSetTransactor : public Transactor { public: - TrustSetTransactor(const SerializedTransaction& txn,TransactionEngineParams params, TransactionEngine::pointer engine) : Transactor(txn,params,engine) {} + TrustSetTransactor(const SerializedTransaction& txn,TransactionEngineParams params, TransactionEngine* engine) : Transactor(txn,params,engine) {} TER doApply(); }; \ No newline at end of file diff --git a/src/cpp/ripple/WalletAddTransactor.h b/src/cpp/ripple/WalletAddTransactor.h index d4df6bd6e7..8bed5f0fe4 100644 --- a/src/cpp/ripple/WalletAddTransactor.h +++ b/src/cpp/ripple/WalletAddTransactor.h @@ -4,7 +4,7 @@ class WalletAddTransactor : public Transactor { public: - WalletAddTransactor(const SerializedTransaction& txn,TransactionEngineParams params, TransactionEngine::pointer engine) : Transactor(txn,params,engine) {} + WalletAddTransactor(const SerializedTransaction& txn,TransactionEngineParams params, TransactionEngine* engine) : Transactor(txn,params,engine) {} TER doApply(); }; \ No newline at end of file diff --git a/src/js/remote.js b/src/js/remote.js index 9e3ee74979..5ae60c0780 100644 --- a/src/js/remote.js +++ b/src/js/remote.js @@ -21,7 +21,7 @@ var EventEmitter = require('events').EventEmitter; var Amount = require('./amount.js').Amount; var UInt160 = require('./amount.js').UInt160; -// Request events emmitted: +// Request events emitted: // 'success' : Request successful. // 'error' : Request failed. // 'remoteError' @@ -166,11 +166,11 @@ Request.prototype.accounts = function (accounts) { // Remote - access to a remote Ripple server via websocket. // // Events: -// 'connectted' +// 'connected' // 'disconnected' // 'state': -// - 'online' : connectted and subscribed -// - 'offline' : not subscribed or not connectted. +// - 'online' : connected and subscribed +// - 'offline' : not subscribed or not connected. // 'ledger_closed': A good indicate of ready to serve. // 'subscribed' : This indicates stand-alone is available. // @@ -268,7 +268,7 @@ Remote.fees = { 'offer' : Amount.from_json("10"), }; -// Set the emited state: 'online' or 'offline' +// Set the emitted state: 'online' or 'offline' Remote.prototype._set_state = function (state) { if (this.trace) console.log("remote: set_state: %s", state); diff --git a/test/config.js b/test/config.js index 42ce8bea47..6a693172d7 100644 --- a/test/config.js +++ b/test/config.js @@ -14,12 +14,13 @@ exports.servers = { // A local test server. "alpha" : { 'trusted' : true, + 'no_server' : true, // "peer_ip" : "0.0.0.0", // "peer_port" : 51235, 'rpc_ip' : "0.0.0.0", 'rpc_port' : 5005, 'websocket_ip' : "127.0.0.1", - 'websocket_port' : 6005, + 'websocket_port' : 5006, // 'validation_seed' : "shhDFVsmS2GSu5vUyZSPXYfj1r79h", // 'validators' : "n9L8LZZCwsdXzKUN9zoVxs4YznYXZ9hEhsQZY7aVpxtFaSceiyDZ beta" } diff --git a/test/send-test.js b/test/send-test.js index 77811d3015..d1ccba2abd 100644 --- a/test/send-test.js +++ b/test/send-test.js @@ -19,7 +19,7 @@ buster.testCase("Sending", { 'setUp' : testutils.build_setup(), 'tearDown' : testutils.build_teardown(), - "send XRP to non-existant account without create." : + "=>send XRP to non-existent account without create." : function (done) { var self = this; var ledgers = 20; @@ -77,7 +77,7 @@ buster.testCase("Sending", { }, // Also test transaction becomes lost after terNO_DST. - "credit_limit to non-existant account = terNO_DST" : + "credit_limit to non-existent account = terNO_DST" : function (done) { this.remote.transaction() .ripple_line_set("root", "100/USD/alice") @@ -102,7 +102,7 @@ buster.testCase("Sending", { testutils.create_accounts(self.remote, "root", "10000", ["alice", "bob", "mtgox"], callback); }, function (callback) { - self.what = "Check a non-existant credit limit."; + self.what = "Check a non-existent credit limit."; self.remote.request_ripple_balance("alice", "mtgox", "USD", 'CURRENT') .on('ripple_state', function (m) {