mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Helper functions.
This commit is contained in:
@@ -1053,6 +1053,22 @@ uint256 Ledger::getLedgerHash(uint32 ledgerIndex)
|
||||
return uint256();
|
||||
}
|
||||
|
||||
std::vector< std::pair<uint32, uint256> > Ledger::getLedgerHashes()
|
||||
{
|
||||
std::vector< std::pair<uint32, uint256> > ret;
|
||||
SLE::pointer hashIndex = getSLE(getLedgerHashIndex());
|
||||
if (hashIndex)
|
||||
{
|
||||
STVector256 vec = hashIndex->getFieldV256(sfHashes);
|
||||
int size = vec.size();
|
||||
ret.reserve(size);
|
||||
uint32 seq = hashIndex->getFieldU32(sfLastLedgerSequence) - size;
|
||||
for (int i = 0; i < size; ++i)
|
||||
ret.push_back(std::make_pair(++seq, vec.at(i)));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
uint256 Ledger::getBookBase(const uint160& uTakerPaysCurrency, const uint160& uTakerPaysIssuerID,
|
||||
const uint160& uTakerGetsCurrency, const uint160& uTakerGetsIssuerID)
|
||||
{
|
||||
|
||||
@@ -200,6 +200,7 @@ public:
|
||||
static int getLedgerHashOffset(uint32 desiredLedgerIndex);
|
||||
static int getLedgerHashOffset(uint32 desiredLedgerIndex, uint32 currentLedgerIndex);
|
||||
uint256 getLedgerHash(uint32 ledgerIndex);
|
||||
std::vector< std::pair<uint32, uint256> > getLedgerHashes();
|
||||
|
||||
static uint256 getLedgerFeatureIndex();
|
||||
static uint256 getLedgerFeeIndex();
|
||||
|
||||
@@ -798,4 +798,10 @@ void LedgerAcquireMaster::sweep()
|
||||
}
|
||||
}
|
||||
|
||||
int LedgerAcquire::getFetchCount()
|
||||
{
|
||||
boost::mutex::scoped_lock sl(mLock);
|
||||
return mLedgers.size();
|
||||
}
|
||||
|
||||
// vim:ts=4
|
||||
|
||||
@@ -146,6 +146,7 @@ public:
|
||||
void dropLedger(const uint256& ledgerHash);
|
||||
SMAddNode gotLedgerData(ripple::TMLedgerData& packet, Peer::ref);
|
||||
|
||||
int getFetchCount();
|
||||
void logFailure(const uint256& h) { mRecentFailures.add(h); }
|
||||
bool isFailure(const uint256& h) { return mRecentFailures.isPresent(h, false); }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user