Helper functions.

This commit is contained in:
JoelKatz
2013-01-11 14:21:31 -08:00
parent 7d7d2bc46b
commit d14d8cbf76
4 changed files with 24 additions and 0 deletions

View File

@@ -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)
{