Clean up the checkAccept path to use the ledger sequence

This commit is contained in:
JoelKatz
2014-01-22 17:09:52 -08:00
parent f88ddc947c
commit 07d16f280c
3 changed files with 9 additions and 3 deletions

View File

@@ -614,12 +614,18 @@ public:
getApp().getInboundLedgers().findCreate(hash, seq, true);
}
void checkAccept (uint256 const& hash)
void checkAccept (uint256 const& hash, uint32 seq)
{
if ((seq == 0) && (seq <= mValidLedgerSeq))
return;
Ledger::pointer ledger = mLedgerHistory.getLedgerByHash (hash);
if (!ledger)
{
// FIXME: We should really only fetch if the ledger
//has sufficient validations to accept it
InboundLedger::pointer l = getApp().getInboundLedgers().findCreateValidationLedger(hash);
if (l && l->isComplete() && !l->isFailed())
ledger = l->getLedger();

View File

@@ -122,7 +122,7 @@ public:
virtual void addValidateCallback (callback& c) = 0;
virtual void checkAccept (Ledger::ref ledger) = 0;
virtual void checkAccept (uint256 const& hash) = 0;
virtual void checkAccept (uint256 const& hash, uint32 seq) = 0;
virtual void tryAdvance () = 0;
virtual void newPathRequest () = 0;

View File

@@ -126,7 +126,7 @@ private:
<< " added " << (val->isTrusted () ? "trusted/" : "UNtrusted/") << (isCurrent ? "current" : "stale");
if (val->isTrusted () && isCurrent)
getApp().getLedgerMaster ().checkAccept (hash);
getApp().getLedgerMaster ().checkAccept (hash, val->getFieldU32 (sfLedgerSequence));
// FIXME: This never forwards untrusted validations
return isCurrent;