Merge branch 'master' of github.com:jedmccaleb/NewCoin into continuousClose

Conflicts:
	src/Ledger.h
	src/LedgerNode.cpp
	src/Version.h
This commit is contained in:
JoelKatz
2012-07-10 10:31:13 -07:00
26 changed files with 1305 additions and 814 deletions

View File

@@ -6,6 +6,8 @@
#include "utils.h"
#include "Log.h"
// XXX Use shared locks where possible?
LedgerStateParms Ledger::writeBack(LedgerStateParms parms, SLE::pointer entry)
{
ScopedLock l(mAccountStateMap->Lock());
@@ -98,7 +100,7 @@ SLE::pointer Ledger::getASNode(LedgerStateParms& parms, const uint256& nodeID,
SLE::pointer sle =
boost::make_shared<SLE>(account->peekSerializer(), nodeID);
if(sle->getType() != let)
if (sle->getType() != let)
{ // maybe it's a currency or something
parms = parms | lepWRONGTYPE;
return SLE::pointer();
@@ -122,6 +124,17 @@ SLE::pointer Ledger::getAccountRoot(LedgerStateParms& parms, const NewcoinAddres
return getAccountRoot(parms, naAccountID.getAccountID());
}
//
// Directory
//
SLE::pointer Ledger::getDirNode(LedgerStateParms& parms, const uint256& uNodeIndex)
{
ScopedLock l(mAccountStateMap->Lock());
return getASNode(parms, uNodeIndex, ltDIR_NODE);
}
//
// Generator Map
//
@@ -144,6 +157,18 @@ SLE::pointer Ledger::getNickname(LedgerStateParms& parms, const uint256& uNickna
return getASNode(parms, uNickname, ltNICKNAME);
}
//
// Offer
//
SLE::pointer Ledger::getOffer(LedgerStateParms& parms, const uint256& uIndex)
{
ScopedLock l(mAccountStateMap->Lock());
return getASNode(parms, uIndex, ltOFFER);
}
//
// Ripple State
//
@@ -155,36 +180,4 @@ SLE::pointer Ledger::getRippleState(LedgerStateParms& parms, const uint256& uNod
return getASNode(parms, uNode, ltRIPPLE_STATE);
}
//
// Directory
//
// For a directory entry put in the 64 bit index or quality.
uint256 Ledger::getDirIndex(const uint256& uBase, const uint64 uNodeDir)
{
// Indexes are stored in big endian format: they print as hex as stored.
// Most significant bytes are first. Least significant bytes repesent adjcent entries.
// We place uNodeDir in the 8 right most bytes to be adjcent.
// Want uNodeDir in big endian format so ++ goes to the next entry for indexes.
uint256 uNode(uBase);
((uint64*) uNode.end())[-1] = htobe64(uNodeDir);
return uNode;
}
SLE::pointer Ledger::getDirRoot(LedgerStateParms& parms, const uint256& uRootIndex)
{
ScopedLock l(mAccountStateMap->Lock());
return getASNode(parms, uRootIndex, ltDIR_ROOT);
}
SLE::pointer Ledger::getDirNode(LedgerStateParms& parms, const uint256& uNodeIndex)
{
ScopedLock l(mAccountStateMap->Lock());
return getASNode(parms, uNodeIndex, ltDIR_NODE);
}
// vim:ts=4