XNS -> XRP

This commit is contained in:
jed
2012-11-04 13:21:19 -08:00
parent f180da5940
commit d023566501
19 changed files with 128 additions and 56 deletions

View File

@@ -206,15 +206,20 @@
<ClInclude Include="src\ConnectionPool.h" /> <ClInclude Include="src\ConnectionPool.h" />
<ClInclude Include="src\Contract.h" /> <ClInclude Include="src\Contract.h" />
<ClInclude Include="src\Conversion.h" /> <ClInclude Include="src\Conversion.h" />
<ClInclude Include="src\FieldNames.h" />
<ClInclude Include="src\HashedObject.h" /> <ClInclude Include="src\HashedObject.h" />
<ClInclude Include="src\HashPrefixes.h" />
<ClInclude Include="src\HttpReply.h" /> <ClInclude Include="src\HttpReply.h" />
<ClInclude Include="src\HttpRequest.h" /> <ClInclude Include="src\HttpRequest.h" />
<ClInclude Include="src\HttpsClient.h" /> <ClInclude Include="src\HttpsClient.h" />
<ClInclude Include="src\InstanceCounter.h" />
<ClInclude Include="src\Interpreter.h" /> <ClInclude Include="src\Interpreter.h" />
<ClInclude Include="src\JobQueue.h" />
<ClInclude Include="src\key.h" /> <ClInclude Include="src\key.h" />
<ClInclude Include="src\Ledger.h" /> <ClInclude Include="src\Ledger.h" />
<ClInclude Include="src\LedgerAcquire.h" /> <ClInclude Include="src\LedgerAcquire.h" />
<ClInclude Include="src\LedgerConsensus.h" /> <ClInclude Include="src\LedgerConsensus.h" />
<ClInclude Include="src\LedgerEntrySet.h" />
<ClInclude Include="src\LedgerFormats.h" /> <ClInclude Include="src\LedgerFormats.h" />
<ClInclude Include="src\LedgerHistory.h" /> <ClInclude Include="src\LedgerHistory.h" />
<ClInclude Include="src\LedgerMaster.h" /> <ClInclude Include="src\LedgerMaster.h" />
@@ -234,8 +239,12 @@
<ClInclude Include="src\Peer.h" /> <ClInclude Include="src\Peer.h" />
<ClInclude Include="src\PeerDoor.h" /> <ClInclude Include="src\PeerDoor.h" />
<ClInclude Include="src\PubKeyCache.h" /> <ClInclude Include="src\PubKeyCache.h" />
<ClInclude Include="src\RangeSet.h" />
<ClInclude Include="src\RequestParser.h" /> <ClInclude Include="src\RequestParser.h" />
<ClInclude Include="src\rfc1751.h" /> <ClInclude Include="src\rfc1751.h" />
<ClInclude Include="src\ripple.pb.h" />
<ClInclude Include="src\RippleAddress.h" />
<ClInclude Include="src\RippleCalc.h" />
<ClInclude Include="src\RippleLines.h" /> <ClInclude Include="src\RippleLines.h" />
<ClInclude Include="src\RippleState.h" /> <ClInclude Include="src\RippleState.h" />
<ClInclude Include="src\RPC.h" /> <ClInclude Include="src\RPC.h" />
@@ -251,19 +260,28 @@
<ClInclude Include="src\SerializedTransaction.h" /> <ClInclude Include="src\SerializedTransaction.h" />
<ClInclude Include="src\SerializedTypes.h" /> <ClInclude Include="src\SerializedTypes.h" />
<ClInclude Include="src\SerializedValidation.h" /> <ClInclude Include="src\SerializedValidation.h" />
<ClInclude Include="src\SerializeProto.h" />
<ClInclude Include="src\Serializer.h" /> <ClInclude Include="src\Serializer.h" />
<ClInclude Include="src\SHAMap.h" /> <ClInclude Include="src\SHAMap.h" />
<ClInclude Include="src\SHAMapSync.h" />
<ClInclude Include="src\SNTPClient.h" />
<ClInclude Include="src\Suppression.h" />
<ClInclude Include="src\TaggedCache.h" /> <ClInclude Include="src\TaggedCache.h" />
<ClInclude Include="src\Transaction.h" /> <ClInclude Include="src\Transaction.h" />
<ClInclude Include="src\TransactionEngine.h" /> <ClInclude Include="src\TransactionEngine.h" />
<ClInclude Include="src\TransactionErr.h" />
<ClInclude Include="src\TransactionFormats.h" /> <ClInclude Include="src\TransactionFormats.h" />
<ClInclude Include="src\TransactionMaster.h" /> <ClInclude Include="src\TransactionMaster.h" />
<ClInclude Include="src\TransactionMeta.h" />
<ClInclude Include="src\types.h" /> <ClInclude Include="src\types.h" />
<ClInclude Include="src\uint256.h" /> <ClInclude Include="src\uint256.h" />
<ClInclude Include="src\UniqueNodeList.h" /> <ClInclude Include="src\UniqueNodeList.h" />
<ClInclude Include="src\utils.h" /> <ClInclude Include="src\utils.h" />
<ClInclude Include="src\ValidationCollection.h" /> <ClInclude Include="src\ValidationCollection.h" />
<ClInclude Include="src\Version.h" />
<ClInclude Include="src\Wallet.h" /> <ClInclude Include="src\Wallet.h" />
<ClInclude Include="src\WSConnection.h" />
<ClInclude Include="src\WSDoor.h" />
<ClInclude Include="src\WSHandler.h" /> <ClInclude Include="src\WSHandler.h" />
<ClInclude Include="TimingService.h" /> <ClInclude Include="TimingService.h" />
<ClInclude Include="ExtendedTransaction.h" /> <ClInclude Include="ExtendedTransaction.h" />

View File

@@ -578,6 +578,60 @@
<ClInclude Include="src\WSHandler.h"> <ClInclude Include="src\WSHandler.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="src\FieldNames.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\HashPrefixes.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\InstanceCounter.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\JobQueue.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\LedgerEntrySet.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\RangeSet.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\ripple.pb.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\RippleAddress.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\RippleCalc.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\SerializeProto.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\SHAMapSync.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\SNTPClient.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\Suppression.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\TransactionErr.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\TransactionMeta.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\Version.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\WSConnection.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\WSDoor.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="wallet.xml" /> <None Include="wallet.xml" />

View File

@@ -16,7 +16,7 @@ SETUP_LOG();
uint64 STAmount::uRateOne = STAmount::getRate(STAmount(1), STAmount(1)); uint64 STAmount::uRateOne = STAmount::getRate(STAmount(1), STAmount(1));
// --> sCurrency: "", "XNS", or three letter ISO code. // --> sCurrency: "", "XRP", or three letter ISO code.
bool STAmount::currencyFromString(uint160& uDstCurrency, const std::string& sCurrency) bool STAmount::currencyFromString(uint160& uDstCurrency, const std::string& sCurrency)
{ {
bool bSuccess = true; bool bSuccess = true;
@@ -1365,19 +1365,19 @@ BOOST_AUTO_TEST_CASE( CustomCurrency_test )
if (STAmount::multiply(STAmount(CURRENCY_ONE, ACCOUNT_ONE, 20), STAmount(3), CURRENCY_ONE, ACCOUNT_ONE).getText() != "60") if (STAmount::multiply(STAmount(CURRENCY_ONE, ACCOUNT_ONE, 20), STAmount(3), CURRENCY_ONE, ACCOUNT_ONE).getText() != "60")
BOOST_FAIL("STAmount multiply fail"); BOOST_FAIL("STAmount multiply fail");
if (STAmount::multiply(STAmount(CURRENCY_ONE, ACCOUNT_ONE, 20), STAmount(3), uint160(), ACCOUNT_XNS).getText() != "60") if (STAmount::multiply(STAmount(CURRENCY_ONE, ACCOUNT_ONE, 20), STAmount(3), uint160(), ACCOUNT_XRP).getText() != "60")
BOOST_FAIL("STAmount multiply fail"); BOOST_FAIL("STAmount multiply fail");
if (STAmount::multiply(STAmount(20), STAmount(3), CURRENCY_ONE, ACCOUNT_ONE).getText() != "60") if (STAmount::multiply(STAmount(20), STAmount(3), CURRENCY_ONE, ACCOUNT_ONE).getText() != "60")
BOOST_FAIL("STAmount multiply fail"); BOOST_FAIL("STAmount multiply fail");
if (STAmount::multiply(STAmount(20), STAmount(3), uint160(), ACCOUNT_XNS).getText() != "60") if (STAmount::multiply(STAmount(20), STAmount(3), uint160(), ACCOUNT_XRP).getText() != "60")
BOOST_FAIL("STAmount multiply fail"); BOOST_FAIL("STAmount multiply fail");
if (STAmount::divide(STAmount(CURRENCY_ONE, ACCOUNT_ONE, 60), STAmount(3), CURRENCY_ONE, ACCOUNT_ONE).getText() != "20") if (STAmount::divide(STAmount(CURRENCY_ONE, ACCOUNT_ONE, 60), STAmount(3), CURRENCY_ONE, ACCOUNT_ONE).getText() != "20")
BOOST_FAIL("STAmount divide fail"); BOOST_FAIL("STAmount divide fail");
if (STAmount::divide(STAmount(CURRENCY_ONE, ACCOUNT_ONE, 60), STAmount(3), uint160(), ACCOUNT_XNS).getText() != "20") if (STAmount::divide(STAmount(CURRENCY_ONE, ACCOUNT_ONE, 60), STAmount(3), uint160(), ACCOUNT_XRP).getText() != "20")
BOOST_FAIL("STAmount divide fail"); BOOST_FAIL("STAmount divide fail");
if (STAmount::divide(STAmount(CURRENCY_ONE, ACCOUNT_ONE, 60), STAmount(CURRENCY_ONE, ACCOUNT_ONE, 3), CURRENCY_ONE, ACCOUNT_ONE).getText() != "20") if (STAmount::divide(STAmount(CURRENCY_ONE, ACCOUNT_ONE, 60), STAmount(CURRENCY_ONE, ACCOUNT_ONE, 3), CURRENCY_ONE, ACCOUNT_ONE).getText() != "20")
BOOST_FAIL("STAmount divide fail"); BOOST_FAIL("STAmount divide fail");
if (STAmount::divide(STAmount(CURRENCY_ONE, ACCOUNT_ONE, 60), STAmount(CURRENCY_ONE, ACCOUNT_ONE, 3), uint160(), ACCOUNT_XNS).getText() != "20") if (STAmount::divide(STAmount(CURRENCY_ONE, ACCOUNT_ONE, 60), STAmount(CURRENCY_ONE, ACCOUNT_ONE, 3), uint160(), ACCOUNT_XRP).getText() != "20")
BOOST_FAIL("STAmount divide fail"); BOOST_FAIL("STAmount divide fail");
STAmount a1(CURRENCY_ONE, ACCOUNT_ONE, 60), a2 (CURRENCY_ONE, ACCOUNT_ONE, 10, -1); STAmount a1(CURRENCY_ONE, ACCOUNT_ONE, 60), a2 (CURRENCY_ONE, ACCOUNT_ONE, 10, -1);

View File

@@ -35,7 +35,7 @@
#define SECTION_VALIDATORS "validators" #define SECTION_VALIDATORS "validators"
#define SECTION_VALIDATORS_SITE "validators_site" #define SECTION_VALIDATORS_SITE "validators_site"
// Fees are in XNS. // Fees are in XRP.
#define DEFAULT_FEE_DEFAULT 10 #define DEFAULT_FEE_DEFAULT 10
#define DEFAULT_FEE_ACCOUNT_CREATE 1000*SYSTEM_CURRENCY_PARTS #define DEFAULT_FEE_ACCOUNT_CREATE 1000*SYSTEM_CURRENCY_PARTS
#define DEFAULT_FEE_NICKNAME_CREATE 1000 #define DEFAULT_FEE_NICKNAME_CREATE 1000

View File

@@ -10,9 +10,9 @@
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
#define SYSTEM_NAME "ripple" #define SYSTEM_NAME "ripple"
#define SYSTEM_CURRENCY_CODE "XNS" #define SYSTEM_CURRENCY_CODE "XRP"
#define SYSTEM_CURRENCY_PRECISION 6 #define SYSTEM_CURRENCY_PRECISION 6
#define SYSTEM_CURRENCY_CODE_RIPPLE "XNR" #define SYSTEM_CURRENCY_CODE_RIPPLE "XRR"
#define SYSTEM_CURRENCY_GIFT 1000ull #define SYSTEM_CURRENCY_GIFT 1000ull
#define SYSTEM_CURRENCY_USERS 100000000ull #define SYSTEM_CURRENCY_USERS 100000000ull

View File

@@ -46,7 +46,7 @@ Interpreter::Interpreter()
mFunctionTable[CANCEL_OP]=new SubOp(); mFunctionTable[CANCEL_OP]=new SubOp();
mFunctionTable[BLOCK_OP]=new SubOp(); mFunctionTable[BLOCK_OP]=new SubOp();
mFunctionTable[BLOCK_END_OP]=new SubOp(); mFunctionTable[BLOCK_END_OP]=new SubOp();
mFunctionTable[SEND_XNS_OP]=new SendXNSOp(); mFunctionTable[SEND_XRP_OP]=new SendXRPOp();
/* /*
mFunctionTable[SEND_OP]=new SendOp(); mFunctionTable[SEND_OP]=new SendOp();
mFunctionTable[REMOVE_CONTRACT_OP]=new SubOp(); mFunctionTable[REMOVE_CONTRACT_OP]=new SubOp();
@@ -63,7 +63,7 @@ Interpreter::Interpreter()
mFunctionTable[GET_LEDGER_TIME_OP]=new SubOp(); mFunctionTable[GET_LEDGER_TIME_OP]=new SubOp();
mFunctionTable[GET_LEDGER_NUM_OP]=new SubOp(); mFunctionTable[GET_LEDGER_NUM_OP]=new SubOp();
mFunctionTable[GET_RAND_FLOAT_OP]=new SubOp(); mFunctionTable[GET_RAND_FLOAT_OP]=new SubOp();
mFunctionTable[GET_XNS_ESCROWED_OP]=new SubOp(); mFunctionTable[GET_XRP_ESCROWED_OP]=new SubOp();
mFunctionTable[GET_RIPPLE_ESCROWED_OP]=new SubOp(); mFunctionTable[GET_RIPPLE_ESCROWED_OP]=new SubOp();
mFunctionTable[GET_RIPPLE_ESCROWED_CURRENCY_OP]=new SubOp(); mFunctionTable[GET_RIPPLE_ESCROWED_CURRENCY_OP]=new SubOp();
mFunctionTable[GET_RIPPLE_ESCROWED_ISSUER]=new GetRippleEscrowedIssuerOp(); mFunctionTable[GET_RIPPLE_ESCROWED_ISSUER]=new GetRippleEscrowedIssuerOp();

View File

@@ -39,12 +39,12 @@ public:
STOP_OP, CANCEL_OP, STOP_OP, CANCEL_OP,
BLOCK_OP, BLOCK_END_OP, BLOCK_OP, BLOCK_END_OP,
SEND_XNS_OP,SEND_OP,REMOVE_CONTRACT_OP,FEE_OP,CHANGE_CONTRACT_OWNER_OP, SEND_XRP_OP,SEND_OP,REMOVE_CONTRACT_OP,FEE_OP,CHANGE_CONTRACT_OWNER_OP,
STOP_REMOVE_OP, STOP_REMOVE_OP,
SET_DATA_OP,GET_DATA_OP, GET_NUM_DATA_OP, SET_DATA_OP,GET_DATA_OP, GET_NUM_DATA_OP,
SET_REGISTER_OP,GET_REGISTER_OP, SET_REGISTER_OP,GET_REGISTER_OP,
GET_ISSUER_ID_OP, GET_OWNER_ID_OP, GET_LEDGER_TIME_OP, GET_LEDGER_NUM_OP, GET_RAND_FLOAT_OP, GET_ISSUER_ID_OP, GET_OWNER_ID_OP, GET_LEDGER_TIME_OP, GET_LEDGER_NUM_OP, GET_RAND_FLOAT_OP,
GET_XNS_ESCROWED_OP, GET_RIPPLE_ESCROWED_OP, GET_RIPPLE_ESCROWED_CURRENCY_OP, GET_RIPPLE_ESCROWED_ISSUER, GET_XRP_ESCROWED_OP, GET_RIPPLE_ESCROWED_OP, GET_RIPPLE_ESCROWED_CURRENCY_OP, GET_RIPPLE_ESCROWED_ISSUER,
GET_ACCEPT_DATA_OP, GET_ACCEPTOR_ID_OP, GET_CONTRACT_ID_OP, GET_ACCEPT_DATA_OP, GET_ACCEPTOR_ID_OP, GET_CONTRACT_ID_OP,
NUM_OF_OPS }; NUM_OF_OPS };

View File

@@ -563,7 +563,7 @@ Json::Value Ledger::getJson(int options)
} }
else else
ledger["closed"] = false; ledger["closed"] = false;
if (mTransactionMap && (full || ((options & LEDGER_JSON_DUMP_TXNS) != 0))) if (mTransactionMap && (full || ((options & LEDGER_JSON_DUMP_TXRP) != 0)))
{ {
Json::Value txns(Json::arrayValue); Json::Value txns(Json::arrayValue);
SHAMapTreeNode::TNType type; SHAMapTreeNode::TNType type;

View File

@@ -35,7 +35,7 @@ enum LedgerStateParms
lepERROR = 32, // error lepERROR = 32, // error
}; };
#define LEDGER_JSON_DUMP_TXNS 0x10000000 #define LEDGER_JSON_DUMP_TXRP 0x10000000
#define LEDGER_JSON_DUMP_STATE 0x20000000 #define LEDGER_JSON_DUMP_STATE 0x20000000
#define LEDGER_JSON_FULL 0x40000000 #define LEDGER_JSON_FULL 0x40000000

View File

@@ -1117,7 +1117,7 @@ void LedgerConsensus::accept(SHAMap::ref set)
{ {
Log(lsTRACE) << "newLCL"; Log(lsTRACE) << "newLCL";
Json::Value p; Json::Value p;
newLCL->addJson(p, LEDGER_JSON_DUMP_TXNS | LEDGER_JSON_DUMP_STATE); newLCL->addJson(p, LEDGER_JSON_DUMP_TXRP | LEDGER_JSON_DUMP_STATE);
Log(lsTRACE) << p; Log(lsTRACE) << p;
} }

View File

@@ -276,7 +276,7 @@ public:
} }
}; };
class SendXNSOp : public Operation class SendXRPOp : public Operation
{ {
public: public:
bool work(Interpreter* interpreter) bool work(Interpreter* interpreter)

View File

@@ -20,8 +20,8 @@ OrderBookDB::OrderBookDB(Ledger::pointer ledger)
mKnownMap[book->getBookBase()]=true; mKnownMap[book->getBookBase()]=true;
if(!book->getCurrencyIn()) if(!book->getCurrencyIn())
{ // XNS { // XRP
mXNSOrders.push_back(book); mXRPOrders.push_back(book);
}else }else
{ {
mIssuerMap[book->getIssuerIn()].push_back(book); mIssuerMap[book->getIssuerIn()].push_back(book);

View File

@@ -9,7 +9,7 @@ But for now it is probably faster to just generate it each time
class OrderBookDB class OrderBookDB
{ {
std::vector<OrderBook::pointer> mEmptyVector; std::vector<OrderBook::pointer> mEmptyVector;
std::vector<OrderBook::pointer> mXNSOrders; std::vector<OrderBook::pointer> mXRPOrders;
std::map<uint160, std::vector<OrderBook::pointer> > mIssuerMap; std::map<uint160, std::vector<OrderBook::pointer> > mIssuerMap;
std::map<uint256, bool > mKnownMap; std::map<uint256, bool > mKnownMap;
@@ -17,8 +17,8 @@ class OrderBookDB
public: public:
OrderBookDB(Ledger::pointer ledger); OrderBookDB(Ledger::pointer ledger);
// return list of all orderbooks that want XNS // return list of all orderbooks that want XRP
std::vector<OrderBook::pointer>& getXNSInBooks(){ return mXNSOrders; } std::vector<OrderBook::pointer>& getXRPInBooks(){ return mXRPOrders; }
// return list of all orderbooks that want IssuerID // return list of all orderbooks that want IssuerID
std::vector<OrderBook::pointer>& getBooks(const uint160& issuerID); std::vector<OrderBook::pointer>& getBooks(const uint160& issuerID);
// return list of all orderbooks that want this issuerID and currencyID // return list of all orderbooks that want this issuerID and currencyID

View File

@@ -21,18 +21,18 @@ TODO: what is a good way to come up with multiple paths?
OrderDB: OrderDB:
getXNSOffers(); getXRPOffers();
// return list of all orderbooks that want XNS // return list of all orderbooks that want XRP
// return list of all orderbooks that want IssuerID // return list of all orderbooks that want IssuerID
// return list of all orderbooks that want this issuerID and currencyID // return list of all orderbooks that want this issuerID and currencyID
*/ */
/* /*
Test sending to XNS Test sending to XRP
Test XNS to XNS Test XRP to XRP
Test offer in middle Test offer in middle
Test XNS to USD Test XRP to USD
Test USD to EUR Test USD to EUR
*/ */
@@ -113,7 +113,7 @@ bool Pathfinder::findPaths(int maxSearchSteps, int maxPay, STPathSet& retPathSet
// found the destination // found the destination
if (!ele.mCurrencyID) { if (!ele.mCurrencyID) {
BOOST_FOREACH(OrderBook::pointer book,mOrderBook.getXNSInBooks()) BOOST_FOREACH(OrderBook::pointer book,mOrderBook.getXRPInBooks())
{ {
//if (!path.hasSeen(line->getAccountIDPeer().getAccountID())) //if (!path.hasSeen(line->getAccountIDPeer().getAccountID()))
{ {
@@ -188,8 +188,8 @@ bool Pathfinder::checkComplete(STPathSet& retPathSet)
// get all the options from this accountID // get all the options from this accountID
// if source is XNS // if source is XRP
// every offer that wants XNS // every offer that wants XRP
// else // else
// every ripple line that starts with the source currency // every ripple line that starts with the source currency
// every offer that we can take that wants the source currency // every offer that we can take that wants the source currency
@@ -197,8 +197,8 @@ bool Pathfinder::checkComplete(STPathSet& retPathSet)
void Pathfinder::addOptions(PathOption::pointer tail) void Pathfinder::addOptions(PathOption::pointer tail)
{ {
if(!tail->mCurrencyID) if(!tail->mCurrencyID)
{ // source XNS { // source XRP
BOOST_FOREACH(OrderBook::pointer book,mOrderBook.getXNSInBooks()) BOOST_FOREACH(OrderBook::pointer book,mOrderBook.getXRPInBooks())
{ {
PathOption::pointer pathOption(new PathOption(tail)); PathOption::pointer pathOption(new PathOption(tail));

View File

@@ -1536,7 +1536,7 @@ TER PathState::pushNode(
terResult = pushImply( terResult = pushImply(
pnCur.uAccountID, // Current account. pnCur.uAccountID, // Current account.
pnCur.uCurrencyID, // Wanted currency. pnCur.uCurrencyID, // Wanted currency.
!!pnCur.uCurrencyID ? uAccountID : ACCOUNT_XNS); // Account as wanted issuer. !!pnCur.uCurrencyID ? uAccountID : ACCOUNT_XRP); // Account as wanted issuer.
// Note: pnPrv may no longer be the immediately previous node. // Note: pnPrv may no longer be the immediately previous node.
} }
@@ -1603,7 +1603,7 @@ TER PathState::pushNode(
terResult = pushImply( terResult = pushImply(
!!pnPrv.uCurrencyID !!pnPrv.uCurrencyID
? ACCOUNT_ONE // Rippling, but offer's don't have an account. ? ACCOUNT_ONE // Rippling, but offer's don't have an account.
: ACCOUNT_XNS, : ACCOUNT_XRP,
pnPrv.uCurrencyID, pnPrv.uCurrencyID,
pnPrv.uIssuerID); pnPrv.uIssuerID);
} }
@@ -1636,8 +1636,8 @@ PathState::PathState(
{ {
const uint160 uInCurrencyID = saSendMax.getCurrency(); const uint160 uInCurrencyID = saSendMax.getCurrency();
const uint160 uOutCurrencyID = saSend.getCurrency(); const uint160 uOutCurrencyID = saSend.getCurrency();
const uint160 uInIssuerID = !!uInCurrencyID ? saSendMax.getIssuer() : ACCOUNT_XNS; const uint160 uInIssuerID = !!uInCurrencyID ? saSendMax.getIssuer() : ACCOUNT_XRP;
const uint160 uOutIssuerID = !!uOutCurrencyID ? saSend.getIssuer() : ACCOUNT_XNS; const uint160 uOutIssuerID = !!uOutCurrencyID ? saSend.getIssuer() : ACCOUNT_XRP;
lesEntries = lesSource.duplicate(); lesEntries = lesSource.duplicate();
@@ -1665,7 +1665,7 @@ PathState::PathState(
? uOutIssuerID == uReceiverID ? uOutIssuerID == uReceiverID
? uReceiverID ? uReceiverID
: uOutIssuerID : uOutIssuerID
: ACCOUNT_XNS; : ACCOUNT_XRP;
// Can't just use push implied, because it can't compensate for next account. // Can't just use push implied, because it can't compensate for next account.
if (!uNxtCurrencyID // Next is XRC - will have offer next if (!uNxtCurrencyID // Next is XRC - will have offer next
@@ -1717,7 +1717,7 @@ PathState::PathState(
| STPathElement::typeIssuer, | STPathElement::typeIssuer,
uReceiverID, // Receive to output uReceiverID, // Receive to output
uOutCurrencyID, // Desired currency uOutCurrencyID, // Desired currency
!!uOutCurrencyID ? uReceiverID : ACCOUNT_XNS); !!uOutCurrencyID ? uReceiverID : ACCOUNT_XRP);
} }
if (tesSUCCESS == terStatus) if (tesSUCCESS == terStatus)
@@ -2428,13 +2428,13 @@ void TransactionEngine::calcNodeOffer(
{ {
TER terResult = temUNKNOWN; TER terResult = temUNKNOWN;
// Direct: not bridging via XNS // Direct: not bridging via XRP
bool bDirectNext = true; // True, if need to load. bool bDirectNext = true; // True, if need to load.
uint256 uDirectQuality; uint256 uDirectQuality;
uint256 uDirectTip = Ledger::getBookBase(uGetsCurrency, uGetsIssuerID, uPaysCurrency, uPaysIssuerID); uint256 uDirectTip = Ledger::getBookBase(uGetsCurrency, uGetsIssuerID, uPaysCurrency, uPaysIssuerID);
uint256 uDirectEnd = Ledger::getQualityNext(uDirectTip); uint256 uDirectEnd = Ledger::getQualityNext(uDirectTip);
// Bridging: bridging via XNS // Bridging: bridging via XRP
bool bBridge = true; // True, if bridging active. False, missing an offer. bool bBridge = true; // True, if bridging active. False, missing an offer.
uint256 uBridgeQuality; uint256 uBridgeQuality;
STAmount saBridgeIn; // Amount available. STAmount saBridgeIn; // Amount available.
@@ -2462,10 +2462,10 @@ void TransactionEngine::calcNodeOffer(
if (!uCurCurrencyID && !uPrvCurrencyID) if (!uCurCurrencyID && !uPrvCurrencyID)
{ {
// Bridging: Neither currency is XNS. // Bridging: Neither currency is XRP.
uInTip = Ledger::getBookBase(uPrvCurrencyID, uPrvIssuerID, CURRENCY_XNS, ACCOUNT_XNS); uInTip = Ledger::getBookBase(uPrvCurrencyID, uPrvIssuerID, CURRENCY_XRP, ACCOUNT_XRP);
uInEnd = Ledger::getQualityNext(uInTip); uInEnd = Ledger::getQualityNext(uInTip);
uOutTip = Ledger::getBookBase(CURRENCY_XNS, ACCOUNT_XNS, uCurCurrencyID, uCurIssuerID); uOutTip = Ledger::getBookBase(CURRENCY_XRP, ACCOUNT_XRP, uCurCurrencyID, uCurIssuerID);
uOutEnd = Ledger::getQualityNext(uInTip); uOutEnd = Ledger::getQualityNext(uInTip);
} }

View File

@@ -25,9 +25,9 @@ enum PathFlags
PF_ISSUE = 0x80, PF_ISSUE = 0x80,
}; };
#define CURRENCY_XNS uint160(0) #define CURRENCY_XRP uint160(0)
#define CURRENCY_ONE uint160(1) // Used as a place holder #define CURRENCY_ONE uint160(1) // Used as a place holder
#define ACCOUNT_XNS uint160(0) #define ACCOUNT_XRP uint160(0)
#define ACCOUNT_ONE uint160(1) // Used as a place holder #define ACCOUNT_ONE uint160(1) // Used as a place holder
DEFINE_INSTANCE(SerializedValue); DEFINE_INSTANCE(SerializedValue);
@@ -209,11 +209,11 @@ class STAmount : public SerializedType
protected: protected:
uint160 mCurrency; // Compared by ==. Always update mIsNative. uint160 mCurrency; // Compared by ==. Always update mIsNative.
uint160 mIssuer; // Not compared by ==. 0 for XNS. uint160 mIssuer; // Not compared by ==. 0 for XRP.
uint64 mValue; uint64 mValue;
int mOffset; int mOffset;
bool mIsNative; // Always !mCurrency. Native is XNS. bool mIsNative; // Always !mCurrency. Native is XRP.
bool mIsNegative; bool mIsNegative;
void canonicalize(); void canonicalize();
@@ -274,7 +274,7 @@ public:
int getExponent() const { return mOffset; } int getExponent() const { return mOffset; }
uint64 getMantissa() const { return mValue; } uint64 getMantissa() const { return mValue; }
// When the currency is XNS, the value in raw units. S=signed // When the currency is XRP, the value in raw units. S=signed
uint64 getNValue() const { if (!mIsNative) throw std::runtime_error("not native"); return mValue; } uint64 getNValue() const { if (!mIsNative) throw std::runtime_error("not native"); return mValue; }
void setNValue(uint64 v) { if (!mIsNative) throw std::runtime_error("not native"); mValue = v; } void setNValue(uint64 v) { if (!mIsNative) throw std::runtime_error("not native"); mValue = v; }
int64 getSNValue() const; int64 getSNValue() const;

View File

@@ -518,9 +518,9 @@ TER TransactionEngine::doPayment(const SerializedTransaction& txn, const Transac
if (bCreate && !saDstAmount.isNative()) if (bCreate && !saDstAmount.isNative())
{ {
// This restriction could be relaxed. // This restriction could be relaxed.
Log(lsINFO) << "doPayment: Invalid transaction: Create account may only fund XNS."; Log(lsINFO) << "doPayment: Invalid transaction: Create account may only fund XRP.";
return temCREATEXNS; return temCREATEXRP;
} }
else if (!bCreate) else if (!bCreate)
{ {
@@ -569,11 +569,11 @@ TER TransactionEngine::doPayment(const SerializedTransaction& txn, const Transac
} }
else else
{ {
// Direct XNS payment. // Direct XRP payment.
STAmount saSrcXNSBalance = mTxnAccount->getFieldAmount(sfBalance); STAmount saSrcXRPBalance = mTxnAccount->getFieldAmount(sfBalance);
if (saSrcXNSBalance < saDstAmount) if (saSrcXRPBalance < saDstAmount)
{ {
// Transaction might succeed, if applied in a different order. // Transaction might succeed, if applied in a different order.
Log(lsINFO) << "doPayment: Delay transaction: Insufficent funds."; Log(lsINFO) << "doPayment: Delay transaction: Insufficent funds.";
@@ -582,7 +582,7 @@ TER TransactionEngine::doPayment(const SerializedTransaction& txn, const Transac
} }
else else
{ {
mTxnAccount->setFieldAmount(sfBalance, saSrcXNSBalance - saDstAmount); mTxnAccount->setFieldAmount(sfBalance, saSrcXRPBalance - saDstAmount);
sleDst->setFieldAmount(sfBalance, sleDst->getFieldAmount(sfBalance) + saDstAmount); sleDst->setFieldAmount(sfBalance, sleDst->getFieldAmount(sfBalance) + saDstAmount);
terResult = tesSUCCESS; terResult = tesSUCCESS;
@@ -953,7 +953,7 @@ Log(lsINFO) << boost::str(boost::format("doOfferCreate: saTakerPays=%s saTakerGe
} }
else if (saTakerPays.isNative() && saTakerGets.isNative()) else if (saTakerPays.isNative() && saTakerGets.isNative())
{ {
Log(lsWARNING) << "doOfferCreate: Malformed offer: XNS for XNS"; Log(lsWARNING) << "doOfferCreate: Malformed offer: XRP for XRP";
terResult = temBAD_OFFER; terResult = temBAD_OFFER;
} }

View File

@@ -34,7 +34,7 @@ bool transResultInfo(TER terCode, std::string& strToken, std::string& strHuman)
{ temBAD_TRANSFER_RATE, "temBAD_TRANSFER_RATE", "Malformed: Transfer rate must be >= 1.0" }, { temBAD_TRANSFER_RATE, "temBAD_TRANSFER_RATE", "Malformed: Transfer rate must be >= 1.0" },
{ temBAD_SET_ID, "temBAD_SET_ID", "Malformed." }, { temBAD_SET_ID, "temBAD_SET_ID", "Malformed." },
{ temBAD_SEQUENCE, "temBAD_SEQUENCE", "Malformed: Sequence in not in the past." }, { temBAD_SEQUENCE, "temBAD_SEQUENCE", "Malformed: Sequence in not in the past." },
{ temCREATEXNS, "temCREATEXNS", "Can not specify non XNS for Create." }, { temCREATEXRP, "temCREATEXRP", "Can not specify non XRP for Create." },
{ temDST_IS_SRC, "temDST_IS_SRC", "Destination may not be source." }, { temDST_IS_SRC, "temDST_IS_SRC", "Destination may not be source." },
{ temDST_NEEDED, "temDST_NEEDED", "Destination not specified." }, { temDST_NEEDED, "temDST_NEEDED", "Destination not specified." },
{ temINSUF_FEE_P, "temINSUF_FEE_P", "Fee not allowed." }, { temINSUF_FEE_P, "temINSUF_FEE_P", "Fee not allowed." },

View File

@@ -36,7 +36,7 @@ enum TER // aka TransactionEngineResult
temBAD_TRANSFER_RATE, temBAD_TRANSFER_RATE,
temBAD_SEQUENCE, temBAD_SEQUENCE,
temBAD_SET_ID, temBAD_SET_ID,
temCREATEXNS, temCREATEXRP,
temDST_IS_SRC, temDST_IS_SRC,
temDST_NEEDED, temDST_NEEDED,
temINSUF_FEE_P, temINSUF_FEE_P,