Rename RippleAsset to Issue and RippleBook to Book:

* Split STAmount out of SerializedTypes.h
* New concept of "Issue consistency": when either both or neither of its
  currency and account are XRP.
* Stop checking for consistency of Issue in its constructor.
* Clarification of mIsNative logic in STAmount.
* Usual cleanups.
This commit is contained in:
Tom Ritchford
2014-07-03 18:20:47 -04:00
committed by Nik Bougalis
parent a96dee85d2
commit 206efbf30d
42 changed files with 1611 additions and 1490 deletions

View File

@@ -78,7 +78,7 @@ TER PathState::pushImpliedNodes (
if (nodes_.back ().currency_ != currency)
{
// Currency is different, need to convert via an offer from an order
// book. xrpIssuer() does double duty as signaling "this is an order
// book. xrpAccount() does double duty as signaling "this is an order
// book".
// Corresponds to "Implies an offer directory" in the diagram, currently
@@ -88,8 +88,8 @@ TER PathState::pushImpliedNodes (
: STPathElement::typeCurrency | STPathElement::typeIssuer;
// The offer's output is what is now wanted.
// xrpIssuer() is a placeholder for offers.
resultCode = pushNode (type, xrpIssuer(), currency, issuer);
// xrpAccount() is a placeholder for offers.
resultCode = pushNode (type, xrpAccount(), currency, issuer);
}
@@ -193,13 +193,13 @@ TER PathState::pushNode (
? issuer
: !!node.currency_ // Not XRP.
? account
: xrpIssuer();
: xrpAccount();
// Zero value - for accounts.
node.saRevRedeem = STAmount (node.currency_, account);
node.saRevRedeem = STAmount ({node.currency_, account});
node.saRevIssue = node.saRevRedeem;
// For order books only - zero currency with the issuer ID.
node.saRevDeliver = STAmount (node.currency_, node.issuer_);
node.saRevDeliver = STAmount ({node.currency_, node.issuer_});
node.saFwdDeliver = node.saRevDeliver;
if (pathIsEmpty)
@@ -220,7 +220,7 @@ TER PathState::pushNode (
resultCode = pushImpliedNodes (
node.account_, node.currency_,
isXRP(node.currency_) ? xrpIssuer() : account);
isXRP(node.currency_) ? xrpAccount() : account);
// Note: previousNode may no longer be the immediately previous node.
}
@@ -322,9 +322,9 @@ TER PathState::pushNode (
? Account(previousNode.issuer_) // Default to previous issuer
: Account(previousNode.account_)
// Or previous account if no previous issuer.
: xrpIssuer();
: xrpAccount();
node.saRateMax = saZero;
node.saRevDeliver = STAmount (node.currency_, node.issuer_);
node.saRevDeliver = STAmount({node.currency_, node.issuer_});
node.saFwdDeliver = node.saRevDeliver;
if (node.currency_.isZero() != node.issuer_.isZero())
@@ -345,7 +345,7 @@ TER PathState::pushNode (
// Insert intermediary issuer account if needed.
resultCode = pushImpliedNodes (
xrpIssuer(), // Rippling, but offers don't have an account.
xrpAccount(), // Rippling, but offers don't have an account.
previousNode.currency_,
previousNode.issuer_);
}
@@ -389,7 +389,7 @@ void PathState::expandPath (
const Currency currencyOutID = saOutReq.getCurrency ();
const Account issuerOutID = saOutReq.getIssuer ();
const Account uSenderIssuerID
= isXRP(uMaxCurrencyID) ? xrpIssuer() : uSenderID;
= isXRP(uMaxCurrencyID) ? xrpAccount() : uSenderID;
// Sender is always issuer for non-XRP.
WriteLog (lsTRACE, RippleCalc)
@@ -450,7 +450,7 @@ void PathState::expandPath (
? (issuerOutID == uReceiverID)
? Account(uReceiverID)
: Account(issuerOutID) // Use implied node.
: xrpIssuer();
: xrpAccount();
WriteLog (lsDEBUG, RippleCalc)
<< "expandPath: implied check:"