mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Clean up the checkAccept path to use the ledger sequence
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user