diff --git a/src/ripple_app/ledger/LedgerMaster.cpp b/src/ripple_app/ledger/LedgerMaster.cpp index 4f4999db4..d1f1ad36f 100644 --- a/src/ripple_app/ledger/LedgerMaster.cpp +++ b/src/ripple_app/ledger/LedgerMaster.cpp @@ -104,11 +104,16 @@ public: { } - std::uint32_t getCurrentLedgerIndex () + LedgerIndex getCurrentLedgerIndex () { return mCurrentLedger.get ()->getLedgerSeq (); } + LedgerIndex getValidLedgerIndex () + { + return mValidLedgerSeq; + } + int getPublishedLedgerAge () { std::uint32_t pubClose = mPubLedgerClose.load(); diff --git a/src/ripple_app/ledger/LedgerMaster.h b/src/ripple_app/ledger/LedgerMaster.h index 099d01893..362f638a5 100644 --- a/src/ripple_app/ledger/LedgerMaster.h +++ b/src/ripple_app/ledger/LedgerMaster.h @@ -47,7 +47,8 @@ public: virtual ~LedgerMaster () = 0; - virtual std::uint32_t getCurrentLedgerIndex () = 0; + virtual LedgerIndex getCurrentLedgerIndex () = 0; + virtual LedgerIndex getValidLedgerIndex () = 0; virtual LockType& peekMutex () = 0; diff --git a/src/ripple_overlay/impl/PeerImp.h b/src/ripple_overlay/impl/PeerImp.h index eda30ed42..edfac9444 100644 --- a/src/ripple_overlay/impl/PeerImp.h +++ b/src/ripple_overlay/impl/PeerImp.h @@ -2606,12 +2606,19 @@ private: try { #endif - Transaction::pointer tx; - if (isSetBit (flags, SF_SIGGOOD)) - tx = boost::make_shared (stx, false); - else - tx = boost::make_shared (stx, true); + if (stx->isFieldPresent(sfLastLedgerSequence) && + (stx->getFieldU32 (sfLastLedgerSequence) < + getApp().getLedgerMaster().getValidLedgerIndex())) + { // Transaction has expired + getApp().getHashRouter().setFlag(stx->getTransactionID(), SF_BAD); + Peer::charge (peer, Resource::feeUnwantedData); + return; + } + + bool needCheck = ! isSetBit (flags, SF_SIGGOOD); + Transaction::pointer tx = + boost::make_shared (stx, needCheck); if (tx->getStatus () == INVALID) {