Add 'getValidatedSeq'.

This commit is contained in:
JoelKatz
2013-02-17 16:49:24 -08:00
parent 862dbd7234
commit 84a2af37f9
2 changed files with 8 additions and 2 deletions

View File

@@ -119,6 +119,11 @@ bool NetworkOPs::haveLedger(uint32 seq)
return mLedgerMaster->haveLedger(seq); return mLedgerMaster->haveLedger(seq);
} }
uint32 NetworkOPs::getValidatedSeq()
{
return mLedgerMaster->getValidatedLedger()->getLedgerSeq();
}
bool NetworkOPs::isValidated(uint32 seq, const uint256& hash) bool NetworkOPs::isValidated(uint32 seq, const uint256& hash)
{ {
if (!isValidated(seq)) if (!isValidated(seq))
@@ -1060,7 +1065,7 @@ void NetworkOPs::setMode(OperatingMode om)
std::vector< std::pair<Transaction::pointer, TransactionMetaSet::pointer> > std::vector< std::pair<Transaction::pointer, TransactionMetaSet::pointer> >
NetworkOPs::getAccountTxs(const RippleAddress& account, uint32 minLedger, uint32 maxLedger) NetworkOPs::getAccountTxs(const RippleAddress& account, uint32 minLedger, uint32 maxLedger)
{ { // can be called with no locks
std::vector< std::pair<Transaction::pointer, TransactionMetaSet::pointer> > ret; std::vector< std::pair<Transaction::pointer, TransactionMetaSet::pointer> > ret;
std::string sql = std::string sql =
@@ -1087,7 +1092,7 @@ std::vector< std::pair<Transaction::pointer, TransactionMetaSet::pointer> >
}else rawMeta.resize(metaSize); }else rawMeta.resize(metaSize);
TransactionMetaSet::pointer meta= boost::make_shared<TransactionMetaSet>(txn->getID(), txn->getLedger(), rawMeta.getData()); TransactionMetaSet::pointer meta= boost::make_shared<TransactionMetaSet>(txn->getID(), txn->getLedger(), rawMeta.getData());
ret.push_back(std::pair<Transaction::pointer, TransactionMetaSet::pointer>(txn,meta)); ret.push_back(std::pair<Transaction::ref, TransactionMetaSet::ref>(txn,meta));
} }
} }

View File

@@ -156,6 +156,7 @@ public:
// Do we have this inclusive range of ledgers in our database // Do we have this inclusive range of ledgers in our database
bool haveLedgerRange(uint32 from, uint32 to); bool haveLedgerRange(uint32 from, uint32 to);
bool haveLedger(uint32 seq); bool haveLedger(uint32 seq);
uint32 getValidatedSeq();
bool isValidated(uint32 seq); bool isValidated(uint32 seq);
bool isValidated(uint32 seq, const uint256& hash); bool isValidated(uint32 seq, const uint256& hash);
bool isValidated(Ledger::ref l) { return isValidated(l->getLedgerSeq(), l->getHash()); } bool isValidated(Ledger::ref l) { return isValidated(l->getLedgerSeq(), l->getHash()); }