Reject expired transactions immediately

This commit is contained in:
JoelKatz
2014-03-28 10:33:53 -07:00
parent a068bff9c1
commit cc5466d450
3 changed files with 20 additions and 7 deletions

View File

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

View File

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

View File

@@ -2606,12 +2606,19 @@ private:
try
{
#endif
Transaction::pointer tx;
if (isSetBit (flags, SF_SIGGOOD))
tx = boost::make_shared<Transaction> (stx, false);
else
tx = boost::make_shared<Transaction> (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<Transaction> (stx, needCheck);
if (tx->getStatus () == INVALID)
{