Avoid processing transactions if we need a network ledger

Not processing tranasctions without a network ledger makes
initial network synchronization faster.
This commit is contained in:
JoelKatz
2014-12-23 09:56:14 -08:00
committed by Nik Bougalis
parent a5df3f1747
commit 4f2d93bb65
2 changed files with 14 additions and 0 deletions

View File

@@ -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);

View File

@@ -972,6 +972,14 @@ PeerImp::onMessage (std::shared_ptr <protocol::TMEndpoints> const& m)
void
PeerImp::onMessage (std::shared_ptr <protocol::TMTransaction> 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