From 4f2d93bb65aefcb330e630953f004dea6c2be23b Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Tue, 23 Dec 2014 09:56:14 -0800 Subject: [PATCH] Avoid processing transactions if we need a network ledger Not processing tranasctions without a network ledger makes initial network synchronization faster. --- src/ripple/app/misc/NetworkOPs.cpp | 6 ++++++ src/ripple/overlay/impl/PeerImp.cpp | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/src/ripple/app/misc/NetworkOPs.cpp b/src/ripple/app/misc/NetworkOPs.cpp index 882c46d761..7a1f03f36b 100644 --- a/src/ripple/app/misc/NetworkOPs.cpp +++ b/src/ripple/app/misc/NetworkOPs.cpp @@ -838,6 +838,12 @@ bool NetworkOPsImp::isValidated (std::uint32_t seq) void NetworkOPsImp::submitTransaction ( Job&, STTx::pointer iTrans, stCallback callback) { + if (isNeedNetworkLedger ()) + { + // Nothing we can do if we've never been in sync + return; + } + // this is an asynchronous interface Serializer s; iTrans->add (s); diff --git a/src/ripple/overlay/impl/PeerImp.cpp b/src/ripple/overlay/impl/PeerImp.cpp index 85adca0f1d..f4cf54b5d0 100644 --- a/src/ripple/overlay/impl/PeerImp.cpp +++ b/src/ripple/overlay/impl/PeerImp.cpp @@ -972,6 +972,14 @@ PeerImp::onMessage (std::shared_ptr const& m) void PeerImp::onMessage (std::shared_ptr const& m) { + + if (getApp().getOPs().isNeedNetworkLedger ()) + { + // If we've never been in synch, there's nothing we can do + // with a transaction + return; + } + Serializer s (m->rawtransaction ()); try