diff --git a/Builds/VisualStudio2013/RippleD.vcxproj b/Builds/VisualStudio2013/RippleD.vcxproj index ac2f4b93f..6a9ff3c92 100644 --- a/Builds/VisualStudio2013/RippleD.vcxproj +++ b/Builds/VisualStudio2013/RippleD.vcxproj @@ -2110,16 +2110,6 @@ - - True - - - - - True - - - True diff --git a/Builds/VisualStudio2013/RippleD.vcxproj.filters b/Builds/VisualStudio2013/RippleD.vcxproj.filters index 85af6ab46..31614008e 100644 --- a/Builds/VisualStudio2013/RippleD.vcxproj.filters +++ b/Builds/VisualStudio2013/RippleD.vcxproj.filters @@ -3039,18 +3039,6 @@ ripple\app\tx - - ripple\app\tx - - - ripple\app\tx - - - ripple\app\tx - - - ripple\app\tx - ripple\app\websocket diff --git a/src/ripple/app/main/Application.cpp b/src/ripple/app/main/Application.cpp index 701dfccad..acdf6fb30 100644 --- a/src/ripple/app/main/Application.cpp +++ b/src/ripple/app/main/Application.cpp @@ -183,7 +183,6 @@ public: std::unique_ptr serverHandler_; std::unique_ptr m_nodeStore; std::unique_ptr m_sntpClient; - std::unique_ptr m_txQueue; std::unique_ptr m_validators; std::unique_ptr m_amendmentTable; std::unique_ptr mFeeTrack; @@ -317,8 +316,6 @@ public: , m_sntpClient (SNTPClient::New (*this)) - , m_txQueue (TxQueue::New ()) - , m_validators (add (Validators::Manager::New ( *this, getConfig ().getModuleDatabasePath (), @@ -464,11 +461,6 @@ public: return *m_resourceManager; } - TxQueue& getTxQueue () - { - return *m_txQueue; - } - OrderBookDB& getOrderBookDB () { return m_orderBookDB; diff --git a/src/ripple/app/main/Application.h b/src/ripple/app/main/Application.h index c033d4b8f..fbbef68cb 100644 --- a/src/ripple/app/main/Application.h +++ b/src/ripple/app/main/Application.h @@ -55,7 +55,6 @@ class PathRequests; class ProofOfWorkFactory; class SerializedLedgerEntry; class TransactionMaster; -class TxQueue; class Validations; class DatabaseCon; @@ -117,7 +116,6 @@ public: virtual NetworkOPs& getOPs () = 0; virtual OrderBookDB& getOrderBookDB () = 0; virtual TransactionMaster& getMasterTransaction () = 0; - virtual TxQueue& getTxQueue () = 0; virtual LocalCredentials& getLocalCredentials () = 0; virtual Resource::Manager& getResourceManager () = 0; virtual PathRequests& getPathRequests () = 0; diff --git a/src/ripple/app/misc/NetworkOPs.cpp b/src/ripple/app/misc/NetworkOPs.cpp index b2192f32a..47506e125 100644 --- a/src/ripple/app/misc/NetworkOPs.cpp +++ b/src/ripple/app/misc/NetworkOPs.cpp @@ -19,8 +19,6 @@ #include #include -#include -#include #include #include #include @@ -195,7 +193,6 @@ public: Transaction::ref tpTrans, bool bAdmin, bool bLocal, bool bFailHard, bool bSubmit); - void runTransactionQueue (); Transaction::pointer processTransactionCb ( Transaction::pointer, bool bAdmin, bool bLocal, bool bFailHard, stCallback); @@ -930,103 +927,6 @@ Transaction::pointer NetworkOPsImp::submitTransactionSync ( return tpTransNew; } -void NetworkOPsImp::runTransactionQueue () -{ - TxQueueEntry::pointer txn; - - for (int i = 0; i < 10; ++i) - { - getApp().getTxQueue ().getJob (txn); - - if (!txn) - return; - - { - auto ev = m_job_queue.getLoadEventAP ( - jtTXN_PROC, "runTxnQ"); - - { - auto lock = getApp().masterLock(); - - auto dbtx = getApp().getMasterTransaction ().fetch ( - txn->getID (), true); - assert (dbtx); - - bool didApply; - TER r = m_ledgerMaster.doTransaction ( - dbtx->getSTransaction (), tapOPEN_LEDGER | tapNO_CHECK_SIGN, - didApply); - dbtx->setResult (r); - - if (isTemMalformed (r)) // malformed, cache bad - getApp().getHashRouter ().setFlag (txn->getID (), SF_BAD); - - - if (isTerRetry (r)) - { - // transaction should be held - m_journal.debug << "QTransaction should be held: " << r; - dbtx->setStatus (HELD); - getApp().getMasterTransaction ().canonicalize (&dbtx); - m_ledgerMaster.addHeldTransaction (dbtx); - } - else if (r == tefPAST_SEQ) - { - // duplicate or conflict - m_journal.info << "QTransaction is obsolete"; - dbtx->setStatus (OBSOLETE); - } - else if (r == tesSUCCESS) - { - m_journal.info - << "QTransaction is now included in open ledger"; - dbtx->setStatus (INCLUDED); - getApp().getMasterTransaction ().canonicalize (&dbtx); - } - else - { - m_journal.debug << "QStatus other than success " << r; - dbtx->setStatus (INVALID); - } - - if (didApply /*|| (mMode != omFULL)*/ ) - { - std::set peers; - - if (getApp().getHashRouter ().swapSet ( - txn->getID (), peers, SF_RELAYED)) - { - m_journal.debug << "relaying"; - protocol::TMTransaction tx; - Serializer s; - dbtx->getSTransaction ()->add (s); - tx.set_rawtransaction ( - &s.getData ().front (), s.getLength ()); - tx.set_status (protocol::tsCURRENT); - tx.set_receivetimestamp (getNetworkTimeNC ()); - // FIXME: This should be when we received it - - getApp ().overlay ().foreach (send_if_not ( - std::make_shared ( - tx, protocol::mtTRANSACTION), - peer_in_set(peers))); - } - else - m_journal.debug << "recently relayed"; - } - - txn->doCallbacks (r); - } - } - } - - if (getApp().getTxQueue ().stopProcessing (txn)) - { - getApp().getIOService ().post (std::bind ( - &NetworkOPsImp::runTransactionQueue, this)); - } -} - Transaction::pointer NetworkOPsImp::processTransactionCb ( Transaction::pointer trans, bool bAdmin, bool bLocal, bool bFailHard, stCallback callback) diff --git a/src/ripple/app/misc/NetworkOPs.h b/src/ripple/app/misc/NetworkOPs.h index bbaecbf6a..9c422bc5b 100644 --- a/src/ripple/app/misc/NetworkOPs.h +++ b/src/ripple/app/misc/NetworkOPs.h @@ -145,7 +145,6 @@ public: stCallback callback = stCallback ()) = 0; virtual Transaction::pointer submitTransactionSync (Transaction::ref tpTrans, bool bAdmin, bool bLocal, bool bFailHard, bool bSubmit) = 0; - virtual void runTransactionQueue () = 0; virtual Transaction::pointer processTransactionCb (Transaction::pointer, bool bAdmin, bool bLocal, bool bFailHard, stCallback) = 0; virtual Transaction::pointer processTransaction (Transaction::pointer transaction, diff --git a/src/ripple/app/node/SqliteFactory.cpp b/src/ripple/app/node/SqliteFactory.cpp index 41f580104..0c29eed4f 100644 --- a/src/ripple/app/node/SqliteFactory.cpp +++ b/src/ripple/app/node/SqliteFactory.cpp @@ -133,7 +133,7 @@ public: pStB.step(); pStB.reset(); - BOOST_FOREACH (NodeObject::Ptr const& object, batch) + for (NodeObject::Ptr const& object : batch) { doBind (pSt, object); diff --git a/src/ripple/app/tx/TxQueue.cpp b/src/ripple/app/tx/TxQueue.cpp deleted file mode 100644 index 3cd0a6e91..000000000 --- a/src/ripple/app/tx/TxQueue.cpp +++ /dev/null @@ -1,151 +0,0 @@ -//------------------------------------------------------------------------------ -/* - This file is part of rippled: https://github.com/ripple/rippled - Copyright (c) 2012, 2013 Ripple Labs Inc. - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ -//============================================================================== - -#include -#include -#include -#include - -namespace ripple { - -class TxQueueImp - : public TxQueue - , public beast::LeakChecked -{ -public: - TxQueueImp () - : mRunning (false) - { - } - - bool addEntryForSigCheck (TxQueueEntry::ref entry) - { - // we always dispatch a thread to check the signature - ScopedLockType sl (mLock); - - if (!mTxMap.insert (valueType (entry->getID (), entry)).second) - { - if (!entry->mCallbacks.empty ()) - mTxMap.left.find (entry->getID ())->second->addCallbacks (*entry); - - return false; - } - - return true; - } - - bool addEntryForExecution (TxQueueEntry::ref entry) - { - ScopedLockType sl (mLock); - - entry->mSigChecked = true; - - std::pair it = mTxMap.insert (valueType (entry->getID (), entry)); - - if (!it.second) - { - // There was an existing entry - it.first->right->mSigChecked = true; - - if (!entry->mCallbacks.empty ()) - it.first->right->addCallbacks (*entry); - } - - if (mRunning) - return false; - - mRunning = true; - return true; // A thread needs to handle this account - } - - TxQueueEntry::pointer removeEntry (uint256 const& id) - { - TxQueueEntry::pointer ret; - - ScopedLockType sl (mLock); - - mapType::left_map::iterator it = mTxMap.left.find (id); - - if (it != mTxMap.left.end ()) - { - ret = it->second; - mTxMap.left.erase (it); - } - - return ret; - } - - void getJob (TxQueueEntry::pointer& job) - { - ScopedLockType sl (mLock); - assert (mRunning); - - if (job) - mTxMap.left.erase (job->getID ()); - - mapType::left_map::iterator it = mTxMap.left.begin (); - - if (it == mTxMap.left.end () || !it->second->mSigChecked) - { - job.reset (); - mRunning = false; - } - else - job = it->second; - } - - bool stopProcessing (TxQueueEntry::ref finishedJob) - { - // returns true if a new thread must be dispatched - ScopedLockType sl (mLock); - assert (mRunning); - - mTxMap.left.erase (finishedJob->getID ()); - - mapType::left_map::iterator it = mTxMap.left.begin (); - - if ((it != mTxMap.left.end ()) && it->second->mSigChecked) - return true; - - mRunning = false; - return false; - } - -private: - typedef boost::bimaps::unordered_set_of leftType; - typedef boost::bimaps::list_of rightType; - typedef boost::bimap mapType; - typedef mapType::value_type valueType; - - typedef RippleMutex LockType; - typedef std::lock_guard ScopedLockType; - LockType mLock; - - mapType mTxMap; - bool mRunning; -}; - -//------------------------------------------------------------------------------ - -TxQueue* TxQueue::New () -{ - return new TxQueueImp; -} - -} // ripple diff --git a/src/ripple/app/tx/TxQueue.h b/src/ripple/app/tx/TxQueue.h deleted file mode 100644 index 096aa4fea..000000000 --- a/src/ripple/app/tx/TxQueue.h +++ /dev/null @@ -1,51 +0,0 @@ -//------------------------------------------------------------------------------ -/* - This file is part of rippled: https://github.com/ripple/rippled - Copyright (c) 2012, 2013 Ripple Labs Inc. - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ -//============================================================================== - -#ifndef RIPPLE_TXQUEUE_H_INCLUDED -#define RIPPLE_TXQUEUE_H_INCLUDED - -// VFALCO TODO merge TxQueueEntry.h into this file -#include - -namespace ripple { - -class TxQueue : beast::LeakChecked -{ -public: - static TxQueue* New (); - - virtual ~TxQueue () { } - - // Return: true = must dispatch signature checker thread - virtual bool addEntryForSigCheck (TxQueueEntry::ref) = 0; - - // Call only if signature is okay. Returns true if new account, must dispatch - virtual bool addEntryForExecution (TxQueueEntry::ref) = 0; - - // Call if signature is bad (returns entry so you can run its callbacks) - virtual TxQueueEntry::pointer removeEntry (uint256 const& txID) = 0; - - // Transaction execution interface - virtual void getJob (TxQueueEntry::pointer&) = 0; - virtual bool stopProcessing (TxQueueEntry::ref finishedJob) = 0; -}; - -} // ripple - -#endif diff --git a/src/ripple/app/tx/TxQueueEntry.cpp b/src/ripple/app/tx/TxQueueEntry.cpp deleted file mode 100644 index 0bd2a22f0..000000000 --- a/src/ripple/app/tx/TxQueueEntry.cpp +++ /dev/null @@ -1,36 +0,0 @@ -//------------------------------------------------------------------------------ -/* - This file is part of rippled: https://github.com/ripple/rippled - Copyright (c) 2012, 2013 Ripple Labs Inc. - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ -//============================================================================== - -#include - -namespace ripple { - -void TxQueueEntry::addCallbacks (const TxQueueEntry& otherEntry) -{ - BOOST_FOREACH (const stCallback & callback, otherEntry.mCallbacks) - mCallbacks.push_back (callback); -} - -void TxQueueEntry::doCallbacks (TER result) -{ - BOOST_FOREACH (const stCallback & callback, mCallbacks) - callback (mTxn, result); -} - -} // ripple diff --git a/src/ripple/app/tx/TxQueueEntry.h b/src/ripple/app/tx/TxQueueEntry.h deleted file mode 100644 index 999ae9e59..000000000 --- a/src/ripple/app/tx/TxQueueEntry.h +++ /dev/null @@ -1,71 +0,0 @@ -//------------------------------------------------------------------------------ -/* - This file is part of rippled: https://github.com/ripple/rippled - Copyright (c) 2012, 2013 Ripple Labs Inc. - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ -//============================================================================== - -#ifndef RIPPLE_TXQUEUEENTRY_H_INCLUDED -#define RIPPLE_TXQUEUEENTRY_H_INCLUDED - -namespace ripple { - -// Allow transactions to be signature checked out of sequence but retired in sequence -class TxQueueEntry -{ -public: - typedef std::shared_ptr pointer; - typedef const std::shared_ptr& ref; - typedef std::function stCallback; // must complete immediately - -public: - TxQueueEntry (Transaction::ref tx, bool sigChecked) : mTxn (tx), mSigChecked (sigChecked) - { - } - - TxQueueEntry () : mSigChecked (false) - { - } - - Transaction::ref getTransaction () const - { - return mTxn; - } - - bool getSigChecked () const - { - return mSigChecked; - } - - uint256 const& getID () const - { - return mTxn->getID (); - } - - void doCallbacks (TER); - -private: - friend class TxQueueImp; - - void addCallbacks (const TxQueueEntry& otherEntry); - - Transaction::pointer mTxn; - bool mSigChecked; - std::list mCallbacks; -}; - -} // ripple - -#endif diff --git a/src/ripple/unity/app.cpp b/src/ripple/unity/app.cpp index 0b6474fc2..492c69d6a 100644 --- a/src/ripple/unity/app.cpp +++ b/src/ripple/unity/app.cpp @@ -26,9 +26,6 @@ #include #include #include -#include -#include -#include #include #include #include