Build the LedgerEngine logic into the Ledger class.

Add index rules for account state and ripple nodes.
This commit is contained in:
JoelKatz
2012-04-16 11:39:29 -07:00
parent 7ab3da2f76
commit cc4b350eb7
3 changed files with 39 additions and 9 deletions

14
src/LedgerIndex.cpp Normal file
View File

@@ -0,0 +1,14 @@
#include "Ledger.h"
uint256 Ledger::getAccountRootIndex(const uint160& accountID)
{ // Index is accountID extended to 256 bits
return accountID.to256();
}
uint256 Ledger::getRippleIndex(const uint160& accountID, const uint160& extendTo, const uint160& currency)
{ // Index is 160-bit account credit extended to, 96-bit XOR of extending account and currency
uint256 base=getAccountRootIndex(extendTo);
memcpy(base.begin() + (160/8), (accountID^currency).begin(), (256/8)-(160/8));
return base;
}