From dbe49bcd87e793bda312f42ab92b75858f9bb30a Mon Sep 17 00:00:00 2001 From: Miguel Portilla Date: Thu, 31 Jul 2014 17:54:52 -0400 Subject: [PATCH] Remove TRUST_NETWORK directive (RIPD-331) --- src/ripple/module/app/consensus/DisputedTx.cpp | 2 -- .../module/app/consensus/LedgerConsensus.cpp | 14 -------------- src/ripple/module/app/ledger/InboundLedger.cpp | 3 --- src/ripple/overlay/impl/PeerImp.h | 15 +-------------- 4 files changed, 1 insertion(+), 33 deletions(-) diff --git a/src/ripple/module/app/consensus/DisputedTx.cpp b/src/ripple/module/app/consensus/DisputedTx.cpp index 12310e1c6..6ed67f616 100644 --- a/src/ripple/module/app/consensus/DisputedTx.cpp +++ b/src/ripple/module/app/consensus/DisputedTx.cpp @@ -19,8 +19,6 @@ namespace ripple { -// #define TRUST_NETWORK - // Track a peer's yes/no vote on a particular disputed transaction void DisputedTx::setVote (NodeID const& peer, bool votesYes) { diff --git a/src/ripple/module/app/consensus/LedgerConsensus.cpp b/src/ripple/module/app/consensus/LedgerConsensus.cpp index f6a8df6f1..fa88dacc2 100644 --- a/src/ripple/module/app/consensus/LedgerConsensus.cpp +++ b/src/ripple/module/app/consensus/LedgerConsensus.cpp @@ -1427,10 +1427,8 @@ private: // Then try to apply the transaction to applyLedger WriteLog (lsINFO, LedgerConsensus) << "Processing candidate transaction: " << item->getTag (); -#ifndef TRUST_NETWORK try { -#endif SerializerIterator sit (item->peekSerializer ()); SerializedTransaction::pointer txn = std::make_shared(sit); @@ -1441,13 +1439,11 @@ private: // later retry. retriableTransactions.push_back (txn); } -#ifndef TRUST_NETWORK } catch (...) { WriteLog (lsWARNING, LedgerConsensus) << " Throws"; } -#endif } } } @@ -1540,14 +1536,8 @@ private: << (retryAssured ? "/retry" : "/final"); WriteLog (lsTRACE, LedgerConsensus) << txn->getJson (0); - // VFALCO TODO figure out what this "trust network" - // is all about and why it needs exceptions. -#ifndef TRUST_NETWORK - try { -#endif - bool didApply; TER result = engine.applyTransaction (*txn, parms, didApply); @@ -1570,16 +1560,12 @@ private: WriteLog (lsDEBUG, LedgerConsensus) << "Transaction retry: " << transHuman (result); return resultRetry; - -#ifndef TRUST_NETWORK } catch (...) { WriteLog (lsWARNING, LedgerConsensus) << "Throws"; return resultFail; } - -#endif } /** diff --git a/src/ripple/module/app/ledger/InboundLedger.cpp b/src/ripple/module/app/ledger/InboundLedger.cpp index b0201de90..eb39ef9a1 100644 --- a/src/ripple/module/app/ledger/InboundLedger.cpp +++ b/src/ripple/module/app/ledger/InboundLedger.cpp @@ -783,9 +783,6 @@ bool InboundLedger::takeHeader (const std::string& data) if (m_journal.warning) m_journal.warning << mLedger->getHash () << "!=" << mHash; mLedger.reset (); -#ifdef TRUST_NETWORK - assert (false); -#endif return false; } diff --git a/src/ripple/overlay/impl/PeerImp.h b/src/ripple/overlay/impl/PeerImp.h index 591bff102..3f5aa9228 100644 --- a/src/ripple/overlay/impl/PeerImp.h +++ b/src/ripple/overlay/impl/PeerImp.h @@ -1078,15 +1078,12 @@ private: static void checkTransaction (Job&, int flags, SerializedTransaction::pointer stx, std::weak_ptr peer) { - #ifndef TRUST_NETWORK try { - #endif - if (stx->isFieldPresent(sfLastLedgerSequence) && (stx->getFieldU32 (sfLastLedgerSequence) < getApp().getLedgerMaster().getValidLedgerIndex())) - { // Transaction has expired + { // Transaction has expired getApp().getHashRouter().setFlag(stx->getTransactionID(), SF_BAD); charge (peer, Resource::feeUnwantedData); return; @@ -1107,16 +1104,12 @@ private: bool const trusted (flags & SF_TRUSTED); getApp().getOPs ().processTransaction (tx, trusted, false, false); - - #ifndef TRUST_NETWORK } catch (...) { getApp().getHashRouter ().setFlag (stx->getTransactionID (), SF_BAD); charge (peer, Resource::feeInvalidRequest); } - - #endif } // Called from our JobQueue @@ -1195,10 +1188,7 @@ private: static void checkValidation (Job&, Overlay* pPeers, SerializedValidation::pointer val, bool isTrusted, bool isCluster, std::shared_ptr packet, std::weak_ptr peer) { - #ifndef TRUST_NETWORK - try - #endif { uint256 signingHash = val->getSigningHash(); if (!isCluster && !val->isValid (signingHash)) @@ -1238,14 +1228,11 @@ private: peer_in_set(peers))); } } - - #ifndef TRUST_NETWORK catch (...) { WriteLog(lsTRACE, Peer) << "Exception processing validation"; charge (peer, Resource::feeInvalidRequest); } - #endif } };