Add ledger fuctionality for NicknameState.

This commit is contained in:
Arthur Britto
2012-06-05 13:05:42 -07:00
parent ea64ee3e58
commit 26d7f0e1a4
5 changed files with 96 additions and 62 deletions

View File

@@ -11,6 +11,29 @@ uint256 Ledger::getAccountRootIndex(const uint160& uAccountID)
return s.getSHA512Half();
}
// What is important:
// --> uNickname: is a Sha256
// <-- SHA512/2: for consistency and speed in generating indexes.
uint256 Ledger::getNicknameIndex(const uint256& uNickname)
{
Serializer s;
s.add16(spaceNickname);
s.add256(uNickname);
return s.getSHA512Half();
}
uint256 Ledger::getGeneratorIndex(const uint160& uGeneratorID)
{
Serializer s;
s.add16(spaceGenerator);
s.add160(uGeneratorID);
return s.getSHA512Half();
}
uint256 Ledger::getRippleStateIndex(const NewcoinAddress& naA, const NewcoinAddress& naB, const uint160& uCurrency)
{
uint160 uAID = naA.getAccountID();
@@ -36,16 +59,6 @@ uint256 Ledger::getRippleDirIndex(const uint160& uAccountID)
return s.getSHA512Half();
}
uint256 Ledger::getGeneratorIndex(const uint160& uGeneratorID)
{
Serializer s;
s.add16(spaceGenerator);
s.add160(uGeneratorID);
return s.getSHA512Half();
}
uint160 Ledger::getOfferBase(const uint160& currencyIn, const uint160& accountIn,
const uint160& currencyOut, const uint160& accountOut)
{