mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Moved cpp code to src/cpp and js code to src/js.
This commit is contained in:
38
src/cpp/ripple/RippleState.cpp
Normal file
38
src/cpp/ripple/RippleState.cpp
Normal file
@@ -0,0 +1,38 @@
|
||||
#include "RippleState.h"
|
||||
|
||||
RippleState::RippleState(SerializedLedgerEntry::pointer ledgerEntry) :
|
||||
mLedgerEntry(ledgerEntry),
|
||||
mValid(false),
|
||||
mViewLowest(true)
|
||||
{
|
||||
if (!mLedgerEntry || mLedgerEntry->getType() != ltRIPPLE_STATE) return;
|
||||
|
||||
mLowLimit = mLedgerEntry->getFieldAmount(sfLowLimit);
|
||||
mHighLimit = mLedgerEntry->getFieldAmount(sfHighLimit);
|
||||
|
||||
mLowID = RippleAddress::createAccountID(mLowLimit.getIssuer());
|
||||
mHighID = RippleAddress::createAccountID(mHighLimit.getIssuer());
|
||||
|
||||
mLowQualityIn = mLedgerEntry->getFieldU32(sfLowQualityIn);
|
||||
mLowQualityOut = mLedgerEntry->getFieldU32(sfLowQualityOut);
|
||||
|
||||
mHighQualityIn = mLedgerEntry->getFieldU32(sfHighQualityIn);
|
||||
mHighQualityOut = mLedgerEntry->getFieldU32(sfHighQualityOut);
|
||||
|
||||
mBalance = mLedgerEntry->getFieldAmount(sfBalance);
|
||||
|
||||
mValid = true;
|
||||
}
|
||||
|
||||
void RippleState::setViewAccount(const uint160& accountID)
|
||||
{
|
||||
bool bViewLowestNew = mLowID.getAccountID() == accountID;
|
||||
|
||||
if (bViewLowestNew != mViewLowest)
|
||||
{
|
||||
mViewLowest = bViewLowestNew;
|
||||
mBalance.negate();
|
||||
}
|
||||
}
|
||||
|
||||
// vim:ts=4
|
||||
Reference in New Issue
Block a user