Rework RPCServer to go through NetworkOPs.

This commit is contained in:
Arthur Britto
2012-05-30 00:41:10 -07:00
parent 02fd3e2f7a
commit 68c8434a2b
14 changed files with 330 additions and 121 deletions

32
src/RippleState.cpp Normal file
View File

@@ -0,0 +1,32 @@
#include "RippleState.h"
RippleState::RippleState(SerializedLedgerEntry::pointer ledgerEntry) :
mLedgerEntry(ledgerEntry),
mValid(false),
mViewLowest(true)
{
if (!mLedgerEntry || mLedgerEntry->getType() != ltRIPPLE_STATE) return;
mLowID = mLedgerEntry->getIValueFieldAccount(sfLowID);
mHighID = mLedgerEntry->getIValueFieldAccount(sfHighID);
mLowLimit = mLedgerEntry->getIValueFieldAmount(sfLowLimit);
mHighLimit = mLedgerEntry->getIValueFieldAmount(sfHighLimit);
// YYY Should never fail.
if (mLowID.isValid() && mHighID.isValid())
mValid = true;
}
void RippleState::setViewAccount(const NewcoinAddress& naView)
{
bool bViewLowestNew = mLowID.getAccountID() == naView.getAccountID();
if (bViewLowestNew != mViewLowest)
{
mViewLowest = bViewLowestNew;
mBalance.changeSign();
}
}
// vim:ts=4