mirror of
https://github.com/XRPLF/rippled.git
synced 2026-10-03 18:28:07 +00:00
Rename NewcoinAddress to RippleAddress.
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
#include "Serializer.h"
|
||||
#include "Log.h"
|
||||
|
||||
AccountState::AccountState(const NewcoinAddress& naAccountID) : mAccountID(naAccountID), mValid(false)
|
||||
AccountState::AccountState(const RippleAddress& naAccountID) : mAccountID(naAccountID), mValid(false)
|
||||
{
|
||||
if (!naAccountID.isValid()) return;
|
||||
|
||||
@@ -22,7 +22,7 @@ AccountState::AccountState(const NewcoinAddress& naAccountID) : mAccountID(naAcc
|
||||
mValid = true;
|
||||
}
|
||||
|
||||
AccountState::AccountState(SLE::ref ledgerEntry, const NewcoinAddress& naAccountID) :
|
||||
AccountState::AccountState(SLE::ref ledgerEntry, const RippleAddress& naAccountID) :
|
||||
mAccountID(naAccountID), mLedgerEntry(ledgerEntry), mValid(false)
|
||||
{
|
||||
if (!mLedgerEntry)
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "../json/value.h"
|
||||
|
||||
#include "types.h"
|
||||
#include "NewcoinAddress.h"
|
||||
#include "RippleAddress.h"
|
||||
#include "SerializedLedger.h"
|
||||
|
||||
class AccountState
|
||||
@@ -21,22 +21,22 @@ public:
|
||||
typedef boost::shared_ptr<AccountState> pointer;
|
||||
|
||||
private:
|
||||
NewcoinAddress mAccountID;
|
||||
NewcoinAddress mAuthorizedKey;
|
||||
RippleAddress mAccountID;
|
||||
RippleAddress mAuthorizedKey;
|
||||
SerializedLedgerEntry::pointer mLedgerEntry;
|
||||
|
||||
bool mValid;
|
||||
|
||||
public:
|
||||
AccountState(const NewcoinAddress& naAccountID); // For new accounts
|
||||
AccountState(SLE::ref ledgerEntry,const NewcoinAddress& naAccountI); // For accounts in a ledger
|
||||
AccountState(const RippleAddress& naAccountID); // For new accounts
|
||||
AccountState(SLE::ref ledgerEntry,const RippleAddress& naAccountI); // For accounts in a ledger
|
||||
|
||||
bool bHaveAuthorizedKey()
|
||||
{
|
||||
return mLedgerEntry->isFieldPresent(sfAuthorizedKey);
|
||||
}
|
||||
|
||||
NewcoinAddress getAuthorizedKey()
|
||||
RippleAddress getAuthorizedKey()
|
||||
{
|
||||
return mLedgerEntry->getFieldAccount(sfAuthorizedKey);
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ STAmount::STAmount(SField::ref n, const Json::Value& v)
|
||||
}
|
||||
else
|
||||
{
|
||||
NewcoinAddress is;
|
||||
RippleAddress is;
|
||||
|
||||
if(!is.setAccountID(issuer.asString()))
|
||||
throw std::runtime_error("invalid issuer");
|
||||
@@ -368,7 +368,7 @@ bool STAmount::setFullValue(const std::string& sAmount, const std::string& sCurr
|
||||
//
|
||||
// Figure out the issuer.
|
||||
//
|
||||
NewcoinAddress naIssuerID;
|
||||
RippleAddress naIssuerID;
|
||||
|
||||
// Issuer must be "" or a valid account string.
|
||||
if (!naIssuerID.setAccountID(sIssuer))
|
||||
@@ -1139,7 +1139,7 @@ std::string STAmount::getFullText() const
|
||||
return str(boost::format("%s/%s/%s")
|
||||
% getText()
|
||||
% getHumanCurrency()
|
||||
% NewcoinAddress::createHumanAccountID(mIssuer));
|
||||
% RippleAddress::createHumanAccountID(mIssuer));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1155,7 +1155,7 @@ std::string STAmount::getExtendedText() const
|
||||
return str(boost::format("%s/%s/%s %dE%d" )
|
||||
% getText()
|
||||
% getHumanCurrency()
|
||||
% NewcoinAddress::createHumanAccountID(mIssuer)
|
||||
% RippleAddress::createHumanAccountID(mIssuer)
|
||||
% getMantissa()
|
||||
% getExponent());
|
||||
}
|
||||
@@ -1172,7 +1172,7 @@ Json::Value STAmount::getJson(int) const
|
||||
|
||||
elem["value"] = getText();
|
||||
elem["currency"] = getHumanCurrency();
|
||||
elem["issuer"] = NewcoinAddress::createHumanAccountID(mIssuer);
|
||||
elem["issuer"] = RippleAddress::createHumanAccountID(mIssuer);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -192,9 +192,9 @@ Application::~Application()
|
||||
void Application::startNewLedger()
|
||||
{
|
||||
// New stuff.
|
||||
NewcoinAddress rootSeedMaster = NewcoinAddress::createSeedGeneric("masterpassphrase");
|
||||
NewcoinAddress rootGeneratorMaster = NewcoinAddress::createGeneratorPublic(rootSeedMaster);
|
||||
NewcoinAddress rootAddress = NewcoinAddress::createAccountPublic(rootGeneratorMaster, 0);
|
||||
RippleAddress rootSeedMaster = RippleAddress::createSeedGeneric("masterpassphrase");
|
||||
RippleAddress rootGeneratorMaster = RippleAddress::createGeneratorPublic(rootSeedMaster);
|
||||
RippleAddress rootAddress = RippleAddress::createAccountPublic(rootGeneratorMaster, 0);
|
||||
|
||||
// Print enough information to be able to claim root account.
|
||||
cLog(lsINFO) << "Root master seed: " << rootSeedMaster.humanSeed();
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#define __CONFIG__
|
||||
|
||||
#include "types.h"
|
||||
#include "NewcoinAddress.h"
|
||||
#include "RippleAddress.h"
|
||||
#include "ParseSection.h"
|
||||
#include "SerializedTypes.h"
|
||||
|
||||
@@ -93,7 +93,7 @@ public:
|
||||
bool RPC_ALLOW_REMOTE;
|
||||
|
||||
// Validation
|
||||
NewcoinAddress VALIDATION_SEED;
|
||||
RippleAddress VALIDATION_SEED;
|
||||
|
||||
// Fees
|
||||
uint64 FEE_DEFAULT; // Default fee.
|
||||
|
||||
@@ -349,7 +349,7 @@ std::vector<Peer::pointer> ConnectionPool::getPeerVector()
|
||||
|
||||
// Now know peer's node public key. Determine if we want to stay connected.
|
||||
// <-- bNew: false = redundant
|
||||
bool ConnectionPool::peerConnected(Peer::ref peer, const NewcoinAddress& naPeer,
|
||||
bool ConnectionPool::peerConnected(Peer::ref peer, const RippleAddress& naPeer,
|
||||
const std::string& strIP, int iPort)
|
||||
{
|
||||
bool bNew = false;
|
||||
@@ -363,7 +363,7 @@ bool ConnectionPool::peerConnected(Peer::ref peer, const NewcoinAddress& naPeer,
|
||||
else
|
||||
{
|
||||
boost::mutex::scoped_lock sl(mPeerLock);
|
||||
boost::unordered_map<NewcoinAddress, Peer::pointer>::iterator itCm = mConnectedMap.find(naPeer);
|
||||
boost::unordered_map<RippleAddress, Peer::pointer>::iterator itCm = mConnectedMap.find(naPeer);
|
||||
|
||||
if (itCm == mConnectedMap.end())
|
||||
{
|
||||
@@ -408,11 +408,11 @@ bool ConnectionPool::peerConnected(Peer::ref peer, const NewcoinAddress& naPeer,
|
||||
}
|
||||
|
||||
// We maintain a map of public key to peer for connected and verified peers. Maintain it.
|
||||
void ConnectionPool::peerDisconnected(Peer::ref peer, const NewcoinAddress& naPeer)
|
||||
void ConnectionPool::peerDisconnected(Peer::ref peer, const RippleAddress& naPeer)
|
||||
{
|
||||
if (naPeer.isValid())
|
||||
{
|
||||
boost::unordered_map<NewcoinAddress, Peer::pointer>::iterator itCm;
|
||||
boost::unordered_map<RippleAddress, Peer::pointer>::iterator itCm;
|
||||
|
||||
boost::mutex::scoped_lock sl(mPeerLock);
|
||||
|
||||
|
||||
@@ -9,14 +9,14 @@
|
||||
#include "types.h"
|
||||
|
||||
//
|
||||
// Access to the Newcoin network.
|
||||
// Access to the Ripple network.
|
||||
//
|
||||
class ConnectionPool
|
||||
{
|
||||
private:
|
||||
boost::mutex mPeerLock;
|
||||
|
||||
typedef std::pair<NewcoinAddress, Peer::pointer> naPeer;
|
||||
typedef std::pair<RippleAddress, Peer::pointer> naPeer;
|
||||
typedef std::pair<ipPort, Peer::pointer> pipPeer;
|
||||
|
||||
// Peers we are connecting with and non-thin peers we are connected to.
|
||||
@@ -28,7 +28,7 @@ private:
|
||||
|
||||
// Non-thin peers which we are connected to.
|
||||
// Peers we have the public key for.
|
||||
boost::unordered_map<NewcoinAddress, Peer::pointer> mConnectedMap;
|
||||
boost::unordered_map<RippleAddress, Peer::pointer> mConnectedMap;
|
||||
|
||||
boost::asio::ssl::context mCtx;
|
||||
|
||||
@@ -72,10 +72,10 @@ public:
|
||||
|
||||
// We know peers node public key.
|
||||
// <-- bool: false=reject
|
||||
bool peerConnected(Peer::ref peer, const NewcoinAddress& naPeer, const std::string& strIP, int iPort);
|
||||
bool peerConnected(Peer::ref peer, const RippleAddress& naPeer, const std::string& strIP, int iPort);
|
||||
|
||||
// No longer connected.
|
||||
void peerDisconnected(Peer::ref peer, const NewcoinAddress& naPeer);
|
||||
void peerDisconnected(Peer::ref peer, const RippleAddress& naPeer);
|
||||
|
||||
// As client accepted.
|
||||
void peerVerified(Peer::ref peer);
|
||||
|
||||
@@ -158,7 +158,7 @@ EC_KEY* CKey::GenerateRootPubKey(BIGNUM* pubGenerator)
|
||||
}
|
||||
|
||||
// --> public generator
|
||||
static BIGNUM* makeHash(const NewcoinAddress& pubGen, int seq, BIGNUM* order)
|
||||
static BIGNUM* makeHash(const RippleAddress& pubGen, int seq, BIGNUM* order)
|
||||
{
|
||||
int subSeq=0;
|
||||
BIGNUM* ret=NULL;
|
||||
@@ -178,7 +178,7 @@ static BIGNUM* makeHash(const NewcoinAddress& pubGen, int seq, BIGNUM* order)
|
||||
}
|
||||
|
||||
// --> public generator
|
||||
EC_KEY* CKey::GeneratePublicDeterministicKey(const NewcoinAddress& pubGen, int seq)
|
||||
EC_KEY* CKey::GeneratePublicDeterministicKey(const RippleAddress& pubGen, int seq)
|
||||
{ // publicKey(n) = rootPublicKey EC_POINT_+ Hash(pubHash|seq)*point
|
||||
EC_KEY* rootKey = CKey::GenerateRootPubKey(pubGen.getGeneratorBN());
|
||||
const EC_POINT* rootPubKey = EC_KEY_get0_public_key(rootKey);
|
||||
@@ -231,14 +231,14 @@ EC_KEY* CKey::GeneratePublicDeterministicKey(const NewcoinAddress& pubGen, int s
|
||||
return success ? pkey : NULL;
|
||||
}
|
||||
|
||||
EC_KEY* CKey::GeneratePrivateDeterministicKey(const NewcoinAddress& pubGen, const uint256& u, int seq)
|
||||
EC_KEY* CKey::GeneratePrivateDeterministicKey(const RippleAddress& pubGen, const uint256& u, int seq)
|
||||
{
|
||||
CBigNum bn(u);
|
||||
return GeneratePrivateDeterministicKey(pubGen, static_cast<BIGNUM*>(&bn), seq);
|
||||
}
|
||||
|
||||
// --> root private key
|
||||
EC_KEY* CKey::GeneratePrivateDeterministicKey(const NewcoinAddress& pubGen, const BIGNUM* rootPrivKey, int seq)
|
||||
EC_KEY* CKey::GeneratePrivateDeterministicKey(const RippleAddress& pubGen, const BIGNUM* rootPrivKey, int seq)
|
||||
{ // privateKey(n) = (rootPrivateKey + Hash(pubHash|seq)) % order
|
||||
BN_CTX* ctx=BN_CTX_new();
|
||||
if(ctx==NULL) return NULL;
|
||||
@@ -327,7 +327,7 @@ BOOST_AUTO_TEST_CASE(DeterminsticKeys_test1)
|
||||
if (priv2.GetHex() != "98BC2EACB26EB021D1A6293C044D88BA2F0B6729A2772DEEBF2E21A263C1740B")
|
||||
BOOST_FAIL("Incorrect private key for generator");
|
||||
|
||||
NewcoinAddress nSeed;
|
||||
RippleAddress nSeed;
|
||||
nSeed.setSeed(seed1);
|
||||
if (nSeed.humanSeed() != "shHM53KPZ87Gwdqarm1bAmPeXg8Tn")
|
||||
BOOST_FAIL("Incorrect human seed");
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
SETUP_LOG();
|
||||
|
||||
Ledger::Ledger(const NewcoinAddress& masterID, uint64 startAmount) : mTotCoins(startAmount), mLedgerSeq(1),
|
||||
Ledger::Ledger(const RippleAddress& masterID, uint64 startAmount) : mTotCoins(startAmount), mLedgerSeq(1),
|
||||
mCloseTime(0), mParentCloseTime(0), mCloseResolution(LEDGER_TIME_ACCURACY), mCloseFlags(0),
|
||||
mClosed(false), mValidHash(false), mAccepted(false), mImmutable(false),
|
||||
mTransactionMap(boost::make_shared<SHAMap>(smtTRANSACTION)),
|
||||
@@ -173,7 +173,7 @@ void Ledger::setAccepted()
|
||||
mImmutable = true;
|
||||
}
|
||||
|
||||
AccountState::pointer Ledger::getAccountState(const NewcoinAddress& accountID)
|
||||
AccountState::pointer Ledger::getAccountState(const RippleAddress& accountID)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
// std::cerr << "Ledger:getAccountState(" << accountID.humanAccountID() << ")" << std::endl;
|
||||
@@ -379,11 +379,11 @@ void Ledger::saveAcceptedLedger(bool fromConsensus)
|
||||
if (!SQL_EXISTS(db, boost::str(AcctTransExists % item->getTag().GetHex())))
|
||||
{
|
||||
// Transaction not in AccountTransactions
|
||||
std::vector<NewcoinAddress> accts = txn->getAffectedAccounts();
|
||||
std::vector<RippleAddress> accts = txn->getAffectedAccounts();
|
||||
|
||||
std::string sql = "INSERT INTO AccountTransactions (TransID, Account, LedgerSeq) VALUES ";
|
||||
bool first = true;
|
||||
for (std::vector<NewcoinAddress>::iterator it = accts.begin(), end = accts.end(); it != end; ++it)
|
||||
for (std::vector<RippleAddress>::iterator it = accts.begin(), end = accts.end(); it != end; ++it)
|
||||
{
|
||||
if (!first)
|
||||
sql += ", ('";
|
||||
@@ -773,7 +773,7 @@ SLE::pointer Ledger::getAccountRoot(const uint160& accountID)
|
||||
return getASNode(qry, getAccountRootIndex(accountID), ltACCOUNT_ROOT);
|
||||
}
|
||||
|
||||
SLE::pointer Ledger::getAccountRoot(const NewcoinAddress& naAccountID)
|
||||
SLE::pointer Ledger::getAccountRoot(const RippleAddress& naAccountID)
|
||||
{
|
||||
LedgerStateParms qry = lepNONE;
|
||||
|
||||
@@ -900,9 +900,9 @@ uint256 Ledger::getBookBase(const uint160& uTakerPaysCurrency, const uint160& uT
|
||||
|
||||
Log(lsINFO) << str(boost::format("getBookBase(%s,%s,%s,%s) = %s")
|
||||
% STAmount::createHumanCurrency(uTakerPaysCurrency)
|
||||
% NewcoinAddress::createHumanAccountID(uTakerPaysIssuerID)
|
||||
% RippleAddress::createHumanAccountID(uTakerPaysIssuerID)
|
||||
% STAmount::createHumanCurrency(uTakerGetsCurrency)
|
||||
% NewcoinAddress::createHumanAccountID(uTakerGetsIssuerID)
|
||||
% RippleAddress::createHumanAccountID(uTakerGetsIssuerID)
|
||||
% uBaseIndex.ToString());
|
||||
|
||||
return uBaseIndex;
|
||||
@@ -970,7 +970,7 @@ uint256 Ledger::getOwnerDirIndex(const uint160& uAccountID)
|
||||
return s.getSHA512Half();
|
||||
}
|
||||
|
||||
uint256 Ledger::getRippleStateIndex(const NewcoinAddress& naA, const NewcoinAddress& naB, const uint160& uCurrency)
|
||||
uint256 Ledger::getRippleStateIndex(const RippleAddress& naA, const RippleAddress& naB, const uint160& uCurrency)
|
||||
{
|
||||
uint160 uAID = naA.getAccountID();
|
||||
uint160 uBID = naB.getAccountID();
|
||||
|
||||
16
src/Ledger.h
16
src/Ledger.h
@@ -85,7 +85,7 @@ protected:
|
||||
SLE::pointer getASNode(LedgerStateParms& parms, const uint256& nodeID, LedgerEntryType let);
|
||||
|
||||
public:
|
||||
Ledger(const NewcoinAddress& masterID, uint64 startAmount); // used for the starting bootstrap ledger
|
||||
Ledger(const RippleAddress& masterID, uint64 startAmount); // used for the starting bootstrap ledger
|
||||
|
||||
Ledger(const uint256 &parentHash, const uint256 &transHash, const uint256 &accountHash,
|
||||
uint64 totCoins, uint32 closeTime, uint32 parentCloseTime, int closeFlags, int closeResolution,
|
||||
@@ -151,10 +151,10 @@ public:
|
||||
static SerializedTransaction::pointer getSTransaction(SHAMapItem::ref, SHAMapTreeNode::TNType);
|
||||
|
||||
// high-level functions
|
||||
AccountState::pointer getAccountState(const NewcoinAddress& acctID);
|
||||
AccountState::pointer getAccountState(const RippleAddress& acctID);
|
||||
LedgerStateParms writeBack(LedgerStateParms parms, SLE::ref);
|
||||
SLE::pointer getAccountRoot(const uint160& accountID);
|
||||
SLE::pointer getAccountRoot(const NewcoinAddress& naAccountID);
|
||||
SLE::pointer getAccountRoot(const RippleAddress& naAccountID);
|
||||
|
||||
// database functions
|
||||
void saveAcceptedLedger(bool fromConsensus);
|
||||
@@ -173,7 +173,7 @@ public:
|
||||
// index calculation functions
|
||||
static uint256 getAccountRootIndex(const uint160& uAccountID);
|
||||
|
||||
static uint256 getAccountRootIndex(const NewcoinAddress& account)
|
||||
static uint256 getAccountRootIndex(const RippleAddress& account)
|
||||
{ return getAccountRootIndex(account.getAccountID()); }
|
||||
|
||||
//
|
||||
@@ -257,9 +257,9 @@ public:
|
||||
//
|
||||
|
||||
// Index of node which is the ripple state between two accounts for a currency.
|
||||
static uint256 getRippleStateIndex(const NewcoinAddress& naA, const NewcoinAddress& naB, const uint160& uCurrency);
|
||||
static uint256 getRippleStateIndex(const RippleAddress& naA, const RippleAddress& naB, const uint160& uCurrency);
|
||||
static uint256 getRippleStateIndex(const uint160& uiA, const uint160& uiB, const uint160& uCurrency)
|
||||
{ return getRippleStateIndex(NewcoinAddress::createAccountID(uiA), NewcoinAddress::createAccountID(uiB), uCurrency); }
|
||||
{ return getRippleStateIndex(RippleAddress::createAccountID(uiA), RippleAddress::createAccountID(uiB), uCurrency); }
|
||||
|
||||
RippleState::pointer accessRippleState(const uint256& uNode);
|
||||
|
||||
@@ -271,11 +271,11 @@ public:
|
||||
return getRippleState(qry, uNode);
|
||||
}
|
||||
|
||||
SLE::pointer getRippleState(const NewcoinAddress& naA, const NewcoinAddress& naB, const uint160& uCurrency)
|
||||
SLE::pointer getRippleState(const RippleAddress& naA, const RippleAddress& naB, const uint160& uCurrency)
|
||||
{ return getRippleState(getRippleStateIndex(naA, naB, uCurrency)); }
|
||||
|
||||
SLE::pointer getRippleState(const uint160& uiA, const uint160& uiB, const uint160& uCurrency)
|
||||
{ return getRippleState(getRippleStateIndex(NewcoinAddress::createAccountID(uiA), NewcoinAddress::createAccountID(uiB), uCurrency)); }
|
||||
{ return getRippleState(getRippleStateIndex(RippleAddress::createAccountID(uiA), RippleAddress::createAccountID(uiB), uCurrency)); }
|
||||
|
||||
Json::Value getJson(int options);
|
||||
void addJson(Json::Value&, int options);
|
||||
|
||||
@@ -239,7 +239,7 @@ LedgerConsensus::LedgerConsensus(const uint256& prevLCLHash, Ledger::ref previou
|
||||
cLog(lsINFO) << "Entering consensus process, validating";
|
||||
mValidating = true;
|
||||
mProposing = theApp->getOPs().getOperatingMode() == NetworkOPs::omFULL;
|
||||
mValPublic = NewcoinAddress::createNodePublic(mValSeed);
|
||||
mValPublic = RippleAddress::createNodePublic(mValSeed);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -87,7 +87,7 @@ protected:
|
||||
Ledger::pointer mPreviousLedger;
|
||||
LedgerAcquire::pointer mAcquiringLedger;
|
||||
LedgerProposal::pointer mOurPosition;
|
||||
NewcoinAddress mValSeed, mValPublic;
|
||||
RippleAddress mValSeed, mValPublic;
|
||||
bool mProposing, mValidating, mHaveCorrectLCL;
|
||||
|
||||
int mCurrentMSeconds, mClosePercent, mCloseResolution;
|
||||
@@ -182,7 +182,7 @@ public:
|
||||
bool peerGaveNodes(Peer::ref peer, const uint256& setHash,
|
||||
const std::list<SHAMapNode>& nodeIDs, const std::list< std::vector<unsigned char> >& nodeData);
|
||||
|
||||
bool isOurPubKey(const NewcoinAddress &k) { return k == mValPublic; }
|
||||
bool isOurPubKey(const RippleAddress &k) { return k == mValPublic; }
|
||||
|
||||
// test/debug
|
||||
void simulate();
|
||||
|
||||
@@ -296,7 +296,7 @@ SLE::pointer LedgerEntrySet::getForMod(const uint256& node, Ledger::ref ledger,
|
||||
|
||||
}
|
||||
|
||||
bool LedgerEntrySet::threadTx(const NewcoinAddress& threadTo, Ledger::ref ledger,
|
||||
bool LedgerEntrySet::threadTx(const RippleAddress& threadTo, Ledger::ref ledger,
|
||||
boost::unordered_map<uint256, SLE::pointer>& newMods)
|
||||
{
|
||||
#ifdef META_DEBUG
|
||||
@@ -415,9 +415,9 @@ void LedgerEntrySet::calcRawMeta(Serializer& s, TER result)
|
||||
if (origNode->getType() == ltRIPPLE_STATE)
|
||||
{
|
||||
mSet.getAffectedNode(it.first).setFieldAccount(sfLowID,
|
||||
NewcoinAddress::createAccountID(origNode->getFieldAmount(sfLowLimit).getIssuer()));
|
||||
RippleAddress::createAccountID(origNode->getFieldAmount(sfLowLimit).getIssuer()));
|
||||
mSet.getAffectedNode(it.first).setFieldAccount(sfHighID,
|
||||
NewcoinAddress::createAccountID(origNode->getFieldAmount(sfHighLimit).getIssuer()));
|
||||
RippleAddress::createAccountID(origNode->getFieldAmount(sfHighLimit).getIssuer()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -845,9 +845,9 @@ STAmount LedgerEntrySet::rippleOwed(const uint160& uToAccountID, const uint160&
|
||||
else
|
||||
{
|
||||
cLog(lsINFO) << "rippleOwed: No credit line between "
|
||||
<< NewcoinAddress::createHumanAccountID(uFromAccountID)
|
||||
<< RippleAddress::createHumanAccountID(uFromAccountID)
|
||||
<< " and "
|
||||
<< NewcoinAddress::createHumanAccountID(uToAccountID)
|
||||
<< RippleAddress::createHumanAccountID(uToAccountID)
|
||||
<< " for "
|
||||
<< STAmount::createHumanCurrency(uCurrencyID)
|
||||
<< "." ;
|
||||
@@ -885,7 +885,7 @@ uint32 LedgerEntrySet::rippleTransferRate(const uint160& uIssuerID)
|
||||
: QUALITY_ONE;
|
||||
|
||||
cLog(lsINFO) << boost::str(boost::format("rippleTransferRate: uIssuerID=%s account_exists=%d transfer_rate=%f")
|
||||
% NewcoinAddress::createHumanAccountID(uIssuerID)
|
||||
% RippleAddress::createHumanAccountID(uIssuerID)
|
||||
% !!sleAccount
|
||||
% (uQuality/1000000000.0));
|
||||
|
||||
@@ -930,8 +930,8 @@ uint32 LedgerEntrySet::rippleQualityIn(const uint160& uToAccountID, const uint16
|
||||
|
||||
cLog(lsINFO) << boost::str(boost::format("rippleQuality: %s uToAccountID=%s uFromAccountID=%s uCurrencyID=%s bLine=%d uQuality=%f")
|
||||
% (sfLow == sfLowQualityIn ? "in" : "out")
|
||||
% NewcoinAddress::createHumanAccountID(uToAccountID)
|
||||
% NewcoinAddress::createHumanAccountID(uFromAccountID)
|
||||
% RippleAddress::createHumanAccountID(uToAccountID)
|
||||
% RippleAddress::createHumanAccountID(uFromAccountID)
|
||||
% STAmount::createHumanCurrency(uCurrencyID)
|
||||
% !!sleRippleState
|
||||
% (uQuality/1000000000.0));
|
||||
@@ -976,7 +976,7 @@ STAmount LedgerEntrySet::accountHolds(const uint160& uAccountID, const uint160&
|
||||
}
|
||||
|
||||
cLog(lsINFO) << boost::str(boost::format("accountHolds: uAccountID=%s saAmount=%s")
|
||||
% NewcoinAddress::createHumanAccountID(uAccountID)
|
||||
% RippleAddress::createHumanAccountID(uAccountID)
|
||||
% saAmount.getFullText());
|
||||
|
||||
return saAmount;
|
||||
@@ -996,7 +996,7 @@ STAmount LedgerEntrySet::accountFunds(const uint160& uAccountID, const STAmount&
|
||||
saFunds = saDefault;
|
||||
|
||||
cLog(lsINFO) << boost::str(boost::format("accountFunds: uAccountID=%s saDefault=%s SELF-FUNDED")
|
||||
% NewcoinAddress::createHumanAccountID(uAccountID)
|
||||
% RippleAddress::createHumanAccountID(uAccountID)
|
||||
% saDefault.getFullText());
|
||||
}
|
||||
else
|
||||
@@ -1004,7 +1004,7 @@ STAmount LedgerEntrySet::accountFunds(const uint160& uAccountID, const STAmount&
|
||||
saFunds = accountHolds(uAccountID, saDefault.getCurrency(), saDefault.getIssuer());
|
||||
|
||||
cLog(lsINFO) << boost::str(boost::format("accountFunds: uAccountID=%s saDefault=%s saFunds=%s")
|
||||
% NewcoinAddress::createHumanAccountID(uAccountID)
|
||||
% RippleAddress::createHumanAccountID(uAccountID)
|
||||
% saDefault.getFullText()
|
||||
% saFunds.getFullText());
|
||||
}
|
||||
@@ -1131,9 +1131,9 @@ void LedgerEntrySet::accountSend(const uint160& uSenderID, const uint160& uRecei
|
||||
: SLE::pointer();
|
||||
|
||||
cLog(lsINFO) << boost::str(boost::format("accountSend> %s (%s) -> %s (%s) : %s")
|
||||
% NewcoinAddress::createHumanAccountID(uSenderID)
|
||||
% RippleAddress::createHumanAccountID(uSenderID)
|
||||
% (sleSender ? (sleSender->getFieldAmount(sfBalance)).getFullText() : "-")
|
||||
% NewcoinAddress::createHumanAccountID(uReceiverID)
|
||||
% RippleAddress::createHumanAccountID(uReceiverID)
|
||||
% (sleReceiver ? (sleReceiver->getFieldAmount(sfBalance)).getFullText() : "-")
|
||||
% saAmount.getFullText());
|
||||
|
||||
@@ -1150,9 +1150,9 @@ void LedgerEntrySet::accountSend(const uint160& uSenderID, const uint160& uRecei
|
||||
}
|
||||
|
||||
cLog(lsINFO) << boost::str(boost::format("accountSend< %s (%s) -> %s (%s) : %s")
|
||||
% NewcoinAddress::createHumanAccountID(uSenderID)
|
||||
% RippleAddress::createHumanAccountID(uSenderID)
|
||||
% (sleSender ? (sleSender->getFieldAmount(sfBalance)).getFullText() : "-")
|
||||
% NewcoinAddress::createHumanAccountID(uReceiverID)
|
||||
% RippleAddress::createHumanAccountID(uReceiverID)
|
||||
% (sleReceiver ? (sleReceiver->getFieldAmount(sfBalance)).getFullText() : "-")
|
||||
% saAmount.getFullText());
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ protected:
|
||||
SLE::pointer getForMod(const uint256& node, Ledger::ref ledger,
|
||||
boost::unordered_map<uint256, SLE::pointer>& newMods);
|
||||
|
||||
bool threadTx(const NewcoinAddress& threadTo, Ledger::ref ledger,
|
||||
bool threadTx(const RippleAddress& threadTo, Ledger::ref ledger,
|
||||
boost::unordered_map<uint256, SLE::pointer>& newMods);
|
||||
|
||||
bool threadTx(SLE::ref threadTo, Ledger::ref ledger, boost::unordered_map<uint256, SLE::pointer>& newMods);
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
#include "Application.h"
|
||||
#include "NewcoinAddress.h"
|
||||
#include "RippleAddress.h"
|
||||
#include "Log.h"
|
||||
|
||||
SETUP_LOG();
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "HashPrefixes.h"
|
||||
|
||||
LedgerProposal::LedgerProposal(const uint256& pLgr, uint32 seq, const uint256& tx, uint32 closeTime,
|
||||
const NewcoinAddress& naPeerPublic) :
|
||||
const RippleAddress& naPeerPublic) :
|
||||
mPreviousLedger(pLgr), mCurrentHash(tx), mCloseTime(closeTime), mProposeSeq(seq), mPublicKey(naPeerPublic)
|
||||
{
|
||||
// XXX Validate key.
|
||||
@@ -20,11 +20,11 @@ LedgerProposal::LedgerProposal(const uint256& pLgr, uint32 seq, const uint256& t
|
||||
}
|
||||
|
||||
|
||||
LedgerProposal::LedgerProposal(const NewcoinAddress& naSeed, const uint256& prevLgr,
|
||||
LedgerProposal::LedgerProposal(const RippleAddress& naSeed, const uint256& prevLgr,
|
||||
const uint256& position, uint32 closeTime) :
|
||||
mPreviousLedger(prevLgr), mCurrentHash(position), mCloseTime(closeTime), mProposeSeq(0),
|
||||
mPublicKey(NewcoinAddress::createNodePublic(naSeed)),
|
||||
mPrivateKey(NewcoinAddress::createNodePrivate(naSeed))
|
||||
mPublicKey(RippleAddress::createNodePublic(naSeed)),
|
||||
mPrivateKey(RippleAddress::createNodePrivate(naSeed))
|
||||
{
|
||||
mPeerID = mPublicKey.getNodeID();
|
||||
mTime = boost::posix_time::second_clock::universal_time();
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "../json/value.h"
|
||||
|
||||
#include "NewcoinAddress.h"
|
||||
#include "RippleAddress.h"
|
||||
#include "Serializer.h"
|
||||
|
||||
class LedgerProposal
|
||||
@@ -19,8 +19,8 @@ protected:
|
||||
uint32 mCloseTime, mProposeSeq;
|
||||
|
||||
uint160 mPeerID;
|
||||
NewcoinAddress mPublicKey;
|
||||
NewcoinAddress mPrivateKey; // If ours
|
||||
RippleAddress mPublicKey;
|
||||
RippleAddress mPrivateKey; // If ours
|
||||
|
||||
std::string mSignature; // set only if needed
|
||||
boost::posix_time::ptime mTime;
|
||||
@@ -32,10 +32,10 @@ public:
|
||||
|
||||
// proposal from peer
|
||||
LedgerProposal(const uint256& prevLgr, uint32 proposeSeq, const uint256& propose,
|
||||
uint32 closeTime, const NewcoinAddress& naPeerPublic);
|
||||
uint32 closeTime, const RippleAddress& naPeerPublic);
|
||||
|
||||
// our first proposal
|
||||
LedgerProposal(const NewcoinAddress& privKey, const uint256& prevLedger, const uint256& position,
|
||||
LedgerProposal(const RippleAddress& privKey, const uint256& prevLedger, const uint256& position,
|
||||
uint32 closeTime);
|
||||
|
||||
// an unsigned "dummy" proposal for nodes not validating
|
||||
@@ -51,7 +51,7 @@ public:
|
||||
const uint256& getPrevLedger() const { return mPreviousLedger; }
|
||||
uint32 getProposeSeq() const { return mProposeSeq; }
|
||||
uint32 getCloseTime() const { return mCloseTime; }
|
||||
const NewcoinAddress& peekPublic() const { return mPublicKey; }
|
||||
const RippleAddress& peekPublic() const { return mPublicKey; }
|
||||
std::vector<unsigned char> getPubKey() const { return mPublicKey.getNodePublic(); }
|
||||
std::vector<unsigned char> sign();
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "LedgerConsensus.h"
|
||||
#include "LedgerTiming.h"
|
||||
#include "Log.h"
|
||||
#include "NewcoinAddress.h"
|
||||
#include "RippleAddress.h"
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
@@ -193,7 +193,7 @@ Transaction::pointer NetworkOPs::findTransactionByID(const uint256& transactionI
|
||||
}
|
||||
|
||||
int NetworkOPs::findTransactionsBySource(const uint256& uLedger, std::list<Transaction::pointer>& txns,
|
||||
const NewcoinAddress& sourceAccount, uint32 minSeq, uint32 maxSeq)
|
||||
const RippleAddress& sourceAccount, uint32 minSeq, uint32 maxSeq)
|
||||
{
|
||||
AccountState::pointer state = getAccountState(uLedger, sourceAccount);
|
||||
if (!state) return 0;
|
||||
@@ -215,7 +215,7 @@ int NetworkOPs::findTransactionsBySource(const uint256& uLedger, std::list<Trans
|
||||
}
|
||||
|
||||
int NetworkOPs::findTransactionsByDestination(std::list<Transaction::pointer>& txns,
|
||||
const NewcoinAddress& destinationAccount, uint32 startLedgerSeq, uint32 endLedgerSeq, int maxTransactions)
|
||||
const RippleAddress& destinationAccount, uint32 startLedgerSeq, uint32 endLedgerSeq, int maxTransactions)
|
||||
{
|
||||
// WRITEME
|
||||
return 0;
|
||||
@@ -225,7 +225,7 @@ int NetworkOPs::findTransactionsByDestination(std::list<Transaction::pointer>& t
|
||||
// Account functions
|
||||
//
|
||||
|
||||
AccountState::pointer NetworkOPs::getAccountState(const uint256& uLedger, const NewcoinAddress& accountID)
|
||||
AccountState::pointer NetworkOPs::getAccountState(const uint256& uLedger, const RippleAddress& accountID)
|
||||
{
|
||||
return mLedgerMaster->getLedgerByHash(uLedger)->getAccountState(accountID);
|
||||
}
|
||||
@@ -294,12 +294,12 @@ NicknameState::pointer NetworkOPs::getNicknameState(const uint256& uLedger, cons
|
||||
// Owner functions
|
||||
//
|
||||
|
||||
Json::Value NetworkOPs::getOwnerInfo(const uint256& uLedger, const NewcoinAddress& naAccount)
|
||||
Json::Value NetworkOPs::getOwnerInfo(const uint256& uLedger, const RippleAddress& naAccount)
|
||||
{
|
||||
return getOwnerInfo(mLedgerMaster->getLedgerByHash(uLedger), naAccount);
|
||||
}
|
||||
|
||||
Json::Value NetworkOPs::getOwnerInfo(Ledger::pointer lpLedger, const NewcoinAddress& naAccount)
|
||||
Json::Value NetworkOPs::getOwnerInfo(Ledger::pointer lpLedger, const RippleAddress& naAccount)
|
||||
{
|
||||
Json::Value jvObjects(Json::objectValue);
|
||||
|
||||
@@ -686,7 +686,7 @@ bool NetworkOPs::haveConsensusObject()
|
||||
|
||||
// <-- bool: true to relay
|
||||
bool NetworkOPs::recvPropose(uint32 proposeSeq, const uint256& proposeHash, const uint256& prevLedger,
|
||||
uint32 closeTime, const std::string& pubKey, const std::string& signature, const NewcoinAddress& nodePublic)
|
||||
uint32 closeTime, const std::string& pubKey, const std::string& signature, const RippleAddress& nodePublic)
|
||||
{
|
||||
// JED: does mConsensus need to be locked?
|
||||
|
||||
@@ -704,7 +704,7 @@ bool NetworkOPs::recvPropose(uint32 proposeSeq, const uint256& proposeHash, cons
|
||||
if (!theApp->isNew(s.getSHA512Half()))
|
||||
return false;
|
||||
|
||||
NewcoinAddress naPeerPublic = NewcoinAddress::createNodePublic(strCopy(pubKey));
|
||||
RippleAddress naPeerPublic = RippleAddress::createNodePublic(strCopy(pubKey));
|
||||
|
||||
if (!haveConsensusObject())
|
||||
{
|
||||
@@ -820,7 +820,7 @@ void NetworkOPs::setMode(OperatingMode om)
|
||||
}
|
||||
|
||||
std::vector< std::pair<uint32, uint256> >
|
||||
NetworkOPs::getAffectedAccounts(const NewcoinAddress& account, uint32 minLedger, uint32 maxLedger)
|
||||
NetworkOPs::getAffectedAccounts(const RippleAddress& account, uint32 minLedger, uint32 maxLedger)
|
||||
{
|
||||
std::vector< std::pair<uint32, uint256> > affectedAccounts;
|
||||
|
||||
@@ -842,14 +842,14 @@ std::vector< std::pair<uint32, uint256> >
|
||||
return affectedAccounts;
|
||||
}
|
||||
|
||||
std::vector<NewcoinAddress>
|
||||
std::vector<RippleAddress>
|
||||
NetworkOPs::getLedgerAffectedAccounts(uint32 ledgerSeq)
|
||||
{
|
||||
std::vector<NewcoinAddress> accounts;
|
||||
std::vector<RippleAddress> accounts;
|
||||
std::string sql = str(boost::format
|
||||
("SELECT DISTINCT Account FROM AccountTransactions INDEXED BY AcctLgrIndex WHERE LedgerSeq = '%d';")
|
||||
% ledgerSeq);
|
||||
NewcoinAddress acct;
|
||||
RippleAddress acct;
|
||||
{
|
||||
Database* db = theApp->getTxnDB()->getDB();
|
||||
ScopedLock dblock = theApp->getTxnDB()->getDBLock();
|
||||
@@ -884,7 +884,7 @@ Json::Value NetworkOPs::getServerInfo()
|
||||
if (!theConfig.VALIDATION_SEED.isValid())
|
||||
info["serverState"] = "none";
|
||||
else
|
||||
info["validationPKey"] = NewcoinAddress::createNodePublic(theConfig.VALIDATION_SEED).humanNodePublic();
|
||||
info["validationPKey"] = RippleAddress::createNodePublic(theConfig.VALIDATION_SEED).humanNodePublic();
|
||||
|
||||
if (mNeedNetworkLedger)
|
||||
info["networkLedger"] = "waiting";
|
||||
@@ -904,7 +904,7 @@ Json::Value NetworkOPs::getServerInfo()
|
||||
// Monitoring: publisher side
|
||||
//
|
||||
|
||||
Json::Value NetworkOPs::pubBootstrapAccountInfo(Ledger::ref lpAccepted, const NewcoinAddress& naAccountID)
|
||||
Json::Value NetworkOPs::pubBootstrapAccountInfo(Ledger::ref lpAccepted, const RippleAddress& naAccountID)
|
||||
{
|
||||
Json::Value jvObj(Json::objectValue);
|
||||
|
||||
@@ -918,7 +918,7 @@ Json::Value NetworkOPs::pubBootstrapAccountInfo(Ledger::ref lpAccepted, const Ne
|
||||
return jvObj;
|
||||
}
|
||||
|
||||
void NetworkOPs::pubAccountInfo(const NewcoinAddress& naAccountID, const Json::Value& jvObj)
|
||||
void NetworkOPs::pubAccountInfo(const RippleAddress& naAccountID, const Json::Value& jvObj)
|
||||
{
|
||||
boost::interprocess::sharable_lock<boost::interprocess::interprocess_upgradable_mutex> sl(mMonitorLock);
|
||||
|
||||
@@ -970,7 +970,7 @@ void NetworkOPs::pubLedger(Ledger::ref lpAccepted)
|
||||
{
|
||||
Json::Value jvAccounts(Json::arrayValue);
|
||||
|
||||
BOOST_FOREACH(const NewcoinAddress& naAccountID, getLedgerAffectedAccounts(lpAccepted->getLedgerSeq()))
|
||||
BOOST_FOREACH(const RippleAddress& naAccountID, getLedgerAffectedAccounts(lpAccepted->getLedgerSeq()))
|
||||
{
|
||||
jvAccounts.append(Json::Value(naAccountID.humanAccountID()));
|
||||
}
|
||||
@@ -1025,7 +1025,7 @@ void NetworkOPs::pubLedger(Ledger::ref lpAccepted)
|
||||
|
||||
BOOST_FOREACH(const subInfoMapType::iterator::value_type& it, mBootAccountInfo)
|
||||
{
|
||||
Json::Value jvObj = pubBootstrapAccountInfo(lpAccepted, NewcoinAddress::createAccountID(it.first));
|
||||
Json::Value jvObj = pubBootstrapAccountInfo(lpAccepted, RippleAddress::createAccountID(it.first));
|
||||
|
||||
BOOST_FOREACH(InfoSub* ispListener, it.second)
|
||||
{
|
||||
@@ -1083,7 +1083,7 @@ void NetworkOPs::pubTransactionAccounts(Ledger::ref lpCurrent, const SerializedT
|
||||
|
||||
if (!mSubAccountTransaction.empty())
|
||||
{
|
||||
BOOST_FOREACH(const NewcoinAddress& naAccountPublic, stTxn.getAffectedAccounts())
|
||||
BOOST_FOREACH(const RippleAddress& naAccountPublic, stTxn.getAffectedAccounts())
|
||||
{
|
||||
subInfoMapIterator simiIt = mSubAccountTransaction.find(naAccountPublic.getAccountID());
|
||||
|
||||
@@ -1128,11 +1128,11 @@ void NetworkOPs::pubTransaction(Ledger::ref lpCurrent, const SerializedTransacti
|
||||
// Monitoring
|
||||
//
|
||||
|
||||
void NetworkOPs::subAccountInfo(InfoSub* ispListener, const boost::unordered_set<NewcoinAddress>& vnaAccountIDs)
|
||||
void NetworkOPs::subAccountInfo(InfoSub* ispListener, const boost::unordered_set<RippleAddress>& vnaAccountIDs)
|
||||
{
|
||||
boost::interprocess::scoped_lock<boost::interprocess::interprocess_upgradable_mutex> sl(mMonitorLock);
|
||||
|
||||
BOOST_FOREACH(const NewcoinAddress& naAccountID, vnaAccountIDs)
|
||||
BOOST_FOREACH(const RippleAddress& naAccountID, vnaAccountIDs)
|
||||
{
|
||||
// Register for bootstrap info.
|
||||
subInfoMapType::iterator simIterator;
|
||||
@@ -1170,11 +1170,11 @@ void NetworkOPs::subAccountInfo(InfoSub* ispListener, const boost::unordered_set
|
||||
}
|
||||
}
|
||||
|
||||
void NetworkOPs::unsubAccountInfo(InfoSub* ispListener, const boost::unordered_set<NewcoinAddress>& vnaAccountIDs)
|
||||
void NetworkOPs::unsubAccountInfo(InfoSub* ispListener, const boost::unordered_set<RippleAddress>& vnaAccountIDs)
|
||||
{
|
||||
boost::interprocess::scoped_lock<boost::interprocess::interprocess_upgradable_mutex> sl(mMonitorLock);
|
||||
|
||||
BOOST_FOREACH(const NewcoinAddress& naAccountID, vnaAccountIDs)
|
||||
BOOST_FOREACH(const RippleAddress& naAccountID, vnaAccountIDs)
|
||||
{
|
||||
subInfoMapType::iterator simIterator = mSubAccountInfo.find(naAccountID.getAccountID());
|
||||
if (simIterator == mSubAccountInfo.end())
|
||||
@@ -1196,11 +1196,11 @@ void NetworkOPs::unsubAccountInfo(InfoSub* ispListener, const boost::unordered_s
|
||||
}
|
||||
}
|
||||
|
||||
void NetworkOPs::subAccountTransaction(InfoSub* ispListener, const boost::unordered_set<NewcoinAddress>& vnaAccountIDs)
|
||||
void NetworkOPs::subAccountTransaction(InfoSub* ispListener, const boost::unordered_set<RippleAddress>& vnaAccountIDs)
|
||||
{
|
||||
boost::interprocess::scoped_lock<boost::interprocess::interprocess_upgradable_mutex> sl(mMonitorLock);
|
||||
|
||||
BOOST_FOREACH(const NewcoinAddress& naAccountID, vnaAccountIDs)
|
||||
BOOST_FOREACH(const RippleAddress& naAccountID, vnaAccountIDs)
|
||||
{
|
||||
subInfoMapType::iterator simIterator = mSubAccountTransaction.find(naAccountID.getAccountID());
|
||||
if (simIterator == mSubAccountTransaction.end())
|
||||
@@ -1219,11 +1219,11 @@ void NetworkOPs::subAccountTransaction(InfoSub* ispListener, const boost::unorde
|
||||
}
|
||||
}
|
||||
|
||||
void NetworkOPs::unsubAccountTransaction(InfoSub* ispListener, const boost::unordered_set<NewcoinAddress>& vnaAccountIDs)
|
||||
void NetworkOPs::unsubAccountTransaction(InfoSub* ispListener, const boost::unordered_set<RippleAddress>& vnaAccountIDs)
|
||||
{
|
||||
boost::interprocess::scoped_lock<boost::interprocess::interprocess_upgradable_mutex> sl(mMonitorLock);
|
||||
|
||||
BOOST_FOREACH(const NewcoinAddress& naAccountID, vnaAccountIDs)
|
||||
BOOST_FOREACH(const RippleAddress& naAccountID, vnaAccountIDs)
|
||||
{
|
||||
subInfoMapType::iterator simIterator = mSubAccountTransaction.find(naAccountID.getAccountID());
|
||||
if (simIterator == mSubAccountTransaction.end())
|
||||
@@ -1260,7 +1260,7 @@ uint32 NetworkOPs::acceptLedger()
|
||||
return mLedgerMaster->getCurrentLedger()->getLedgerSeq();
|
||||
}
|
||||
|
||||
void NetworkOPs::storeProposal(const LedgerProposal::pointer& proposal, const NewcoinAddress& peerPublic)
|
||||
void NetworkOPs::storeProposal(const LedgerProposal::pointer& proposal, const RippleAddress& peerPublic)
|
||||
{
|
||||
std::list<LedgerProposal::pointer>& props = mStoredProposals[peerPublic.getNodeID()];
|
||||
if (props.size() >= (mLastCloseProposers + 10))
|
||||
|
||||
@@ -88,7 +88,7 @@ protected:
|
||||
void pubTransactionAccounts(Ledger::ref lpCurrent, const SerializedTransaction& stTxn, TER terResult, bool bAccepted);
|
||||
bool haveConsensusObject();
|
||||
|
||||
Json::Value pubBootstrapAccountInfo(Ledger::ref lpAccepted, const NewcoinAddress& naAccountID);
|
||||
Json::Value pubBootstrapAccountInfo(Ledger::ref lpAccepted, const RippleAddress& naAccountID);
|
||||
|
||||
public:
|
||||
NetworkOPs(boost::asio::io_service& io_service, LedgerMaster* pLedgerMaster);
|
||||
@@ -123,16 +123,16 @@ public:
|
||||
|
||||
Transaction::pointer processTransaction(Transaction::pointer transaction, Peer* source = NULL);
|
||||
Transaction::pointer findTransactionByID(const uint256& transactionID);
|
||||
int findTransactionsBySource(const uint256& uLedger, std::list<Transaction::pointer>&, const NewcoinAddress& sourceAccount,
|
||||
int findTransactionsBySource(const uint256& uLedger, std::list<Transaction::pointer>&, const RippleAddress& sourceAccount,
|
||||
uint32 minSeq, uint32 maxSeq);
|
||||
int findTransactionsByDestination(std::list<Transaction::pointer>&, const NewcoinAddress& destinationAccount,
|
||||
int findTransactionsByDestination(std::list<Transaction::pointer>&, const RippleAddress& destinationAccount,
|
||||
uint32 startLedgerSeq, uint32 endLedgerSeq, int maxTransactions);
|
||||
|
||||
//
|
||||
// Account functions
|
||||
//
|
||||
|
||||
AccountState::pointer getAccountState(const uint256& uLedger, const NewcoinAddress& accountID);
|
||||
AccountState::pointer getAccountState(const uint256& uLedger, const RippleAddress& accountID);
|
||||
SLE::pointer getGenerator(const uint256& uLedger, const uint160& uGeneratorID);
|
||||
|
||||
//
|
||||
@@ -152,8 +152,8 @@ public:
|
||||
// Owner functions
|
||||
//
|
||||
|
||||
Json::Value getOwnerInfo(const uint256& uLedger, const NewcoinAddress& naAccount);
|
||||
Json::Value getOwnerInfo(Ledger::pointer lpLedger, const NewcoinAddress& naAccount);
|
||||
Json::Value getOwnerInfo(const uint256& uLedger, const RippleAddress& naAccount);
|
||||
Json::Value getOwnerInfo(Ledger::pointer lpLedger, const RippleAddress& naAccount);
|
||||
|
||||
// raw object operations
|
||||
bool findRawLedger(const uint256& ledgerHash, std::vector<unsigned char>& rawLedger);
|
||||
@@ -169,7 +169,7 @@ public:
|
||||
|
||||
// ledger proposal/close functions
|
||||
bool recvPropose(uint32 proposeSeq, const uint256& proposeHash, const uint256& prevLedger, uint32 closeTime,
|
||||
const std::string& pubKey, const std::string& signature, const NewcoinAddress& nodePublic);
|
||||
const std::string& pubKey, const std::string& signature, const RippleAddress& nodePublic);
|
||||
bool gotTXData(const boost::shared_ptr<Peer>& peer, const uint256& hash,
|
||||
const std::list<SHAMapNode>& nodeIDs, const std::list< std::vector<unsigned char> >& nodeData);
|
||||
bool recvValidation(const SerializedValidation::pointer& val);
|
||||
@@ -198,19 +198,19 @@ public:
|
||||
uint32 acceptLedger();
|
||||
boost::unordered_map<uint160,
|
||||
std::list<LedgerProposal::pointer> >& peekStoredProposals() { return mStoredProposals; }
|
||||
void storeProposal(const LedgerProposal::pointer& proposal, const NewcoinAddress& peerPublic);
|
||||
void storeProposal(const LedgerProposal::pointer& proposal, const RippleAddress& peerPublic);
|
||||
|
||||
// client information retrieval functions
|
||||
std::vector< std::pair<uint32, uint256> >
|
||||
getAffectedAccounts(const NewcoinAddress& account, uint32 minLedger, uint32 maxLedger);
|
||||
std::vector<NewcoinAddress> getLedgerAffectedAccounts(uint32 ledgerSeq);
|
||||
getAffectedAccounts(const RippleAddress& account, uint32 minLedger, uint32 maxLedger);
|
||||
std::vector<RippleAddress> getLedgerAffectedAccounts(uint32 ledgerSeq);
|
||||
std::vector<SerializedTransaction> getLedgerTransactions(uint32 ledgerSeq);
|
||||
|
||||
//
|
||||
// Monitoring: publisher side
|
||||
//
|
||||
|
||||
void pubAccountInfo(const NewcoinAddress& naAccountID, const Json::Value& jvObj);
|
||||
void pubAccountInfo(const RippleAddress& naAccountID, const Json::Value& jvObj);
|
||||
void pubLedger(Ledger::ref lpAccepted);
|
||||
void pubTransaction(Ledger::ref lpLedger, const SerializedTransaction& stTxn, TER terResult);
|
||||
|
||||
@@ -219,11 +219,11 @@ public:
|
||||
//
|
||||
|
||||
// --> vnaAddress: empty = all
|
||||
void subAccountInfo(InfoSub* ispListener, const boost::unordered_set<NewcoinAddress>& vnaAccountIDs);
|
||||
void unsubAccountInfo(InfoSub* ispListener, const boost::unordered_set<NewcoinAddress>& vnaAccountIDs);
|
||||
void subAccountInfo(InfoSub* ispListener, const boost::unordered_set<RippleAddress>& vnaAccountIDs);
|
||||
void unsubAccountInfo(InfoSub* ispListener, const boost::unordered_set<RippleAddress>& vnaAccountIDs);
|
||||
|
||||
void subAccountTransaction(InfoSub* ispListener, const boost::unordered_set<NewcoinAddress>& vnaAccountIDs);
|
||||
void unsubAccountTransaction(InfoSub* ispListener, const boost::unordered_set<NewcoinAddress>& vnaAccountIDs);
|
||||
void subAccountTransaction(InfoSub* ispListener, const boost::unordered_set<RippleAddress>& vnaAccountIDs);
|
||||
void unsubAccountTransaction(InfoSub* ispListener, const boost::unordered_set<RippleAddress>& vnaAccountIDs);
|
||||
|
||||
// void subAccountChanges(InfoSub* ispListener, const uint256 uLedgerHash);
|
||||
// void unsubAccountChanges(InfoSub* ispListener);
|
||||
|
||||
@@ -18,7 +18,7 @@ STAmount NicknameState::getMinimumOffer() const
|
||||
: STAmount();
|
||||
}
|
||||
|
||||
NewcoinAddress NicknameState::getAccountID() const
|
||||
RippleAddress NicknameState::getAccountID() const
|
||||
{
|
||||
return mLedgerEntry->getFieldAccount(sfAccount);
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ public:
|
||||
|
||||
bool haveMinimumOffer() const;
|
||||
STAmount getMinimumOffer() const;
|
||||
NewcoinAddress getAccountID() const;
|
||||
RippleAddress getAccountID() const;
|
||||
|
||||
SerializedLedgerEntry::pointer getSLE() { return mLedgerEntry; }
|
||||
const SerializedLedgerEntry& peekSLE() const { return *mLedgerEntry; }
|
||||
|
||||
@@ -76,7 +76,7 @@ PathOption::PathOption(PathOption::pointer other)
|
||||
}
|
||||
|
||||
|
||||
Pathfinder::Pathfinder(NewcoinAddress& srcAccountID, NewcoinAddress& dstAccountID, uint160& srcCurrencyID, STAmount dstAmount) :
|
||||
Pathfinder::Pathfinder(RippleAddress& srcAccountID, RippleAddress& dstAccountID, uint160& srcCurrencyID, STAmount dstAmount) :
|
||||
mSrcAccountID(srcAccountID.getAccountID()), mDstAccountID(dstAccountID.getAccountID()), mDstAmount(dstAmount), mSrcCurrencyID(srcCurrencyID), mOrderBook(theApp->getMasterLedger().getCurrentLedger())
|
||||
{
|
||||
mLedger=theApp->getMasterLedger().getCurrentLedger();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "SerializedTypes.h"
|
||||
#include "NewcoinAddress.h"
|
||||
#include "RippleAddress.h"
|
||||
#include "OrderBookDB.h"
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
@@ -44,7 +44,7 @@ class Pathfinder
|
||||
void addPathOption(PathOption::pointer pathOption);
|
||||
|
||||
public:
|
||||
Pathfinder(NewcoinAddress& srcAccountID, NewcoinAddress& dstAccountID, uint160& srcCurrencyID, STAmount dstAmount);
|
||||
Pathfinder(RippleAddress& srcAccountID, RippleAddress& dstAccountID, uint160& srcCurrencyID, STAmount dstAmount);
|
||||
|
||||
// returns false if there is no path. otherwise fills out retPath
|
||||
bool findPaths(int maxSearchSteps, int maxPay, STPathSet& retPathSet);
|
||||
|
||||
@@ -39,7 +39,7 @@ private:
|
||||
bool mClientConnect; // In process of connecting as client.
|
||||
bool mHelloed; // True, if hello accepted.
|
||||
bool mDetaching; // True, if detaching.
|
||||
NewcoinAddress mNodePublic; // Node public key of peer.
|
||||
RippleAddress mNodePublic; // Node public key of peer.
|
||||
ipPort mIpPort;
|
||||
ipPort mIpPortConnect;
|
||||
uint256 mCookieHash;
|
||||
@@ -158,7 +158,7 @@ public:
|
||||
uint256 getClosedLedgerHash() const { return mClosedLedgerHash; }
|
||||
bool hasLedger(const uint256& hash) const;
|
||||
bool hasTxSet(const uint256& hash) const;
|
||||
NewcoinAddress getNodePublic() const { return mNodePublic; }
|
||||
RippleAddress getNodePublic() const { return mNodePublic; }
|
||||
void cycleStatus() { mPreviousLedgerHash = mClosedLedgerHash; mClosedLedgerHash.zero(); }
|
||||
};
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#include "PubKeyCache.h"
|
||||
#include "Application.h"
|
||||
|
||||
CKey::pointer PubKeyCache::locate(const NewcoinAddress& id)
|
||||
CKey::pointer PubKeyCache::locate(const RippleAddress& id)
|
||||
{
|
||||
{ // is it in cache
|
||||
boost::mutex::scoped_lock sl(mLock);
|
||||
std::map<NewcoinAddress, CKey::pointer>::iterator it(mCache.find(id));
|
||||
std::map<RippleAddress, CKey::pointer>::iterator it(mCache.find(id));
|
||||
if(it!=mCache.end()) return it->second;
|
||||
}
|
||||
|
||||
@@ -39,11 +39,11 @@ CKey::pointer PubKeyCache::locate(const NewcoinAddress& id)
|
||||
return ckp;
|
||||
}
|
||||
|
||||
CKey::pointer PubKeyCache::store(const NewcoinAddress& id, const CKey::pointer& key)
|
||||
CKey::pointer PubKeyCache::store(const RippleAddress& id, const CKey::pointer& key)
|
||||
{ // stored if needed, returns cached copy (possibly the original)
|
||||
{
|
||||
boost::mutex::scoped_lock sl(mLock);
|
||||
std::pair<std::map<NewcoinAddress,CKey::pointer>::iterator, bool> pit(mCache.insert(std::make_pair(id, key)));
|
||||
std::pair<std::map<RippleAddress,CKey::pointer>::iterator, bool> pit(mCache.insert(std::make_pair(id, key)));
|
||||
if(!pit.second) // there was an existing key
|
||||
return pit.first->second;
|
||||
}
|
||||
|
||||
@@ -5,20 +5,20 @@
|
||||
|
||||
#include <boost/thread/mutex.hpp>
|
||||
|
||||
#include "NewcoinAddress.h"
|
||||
#include "RippleAddress.h"
|
||||
#include "key.h"
|
||||
|
||||
class PubKeyCache
|
||||
{
|
||||
private:
|
||||
boost::mutex mLock;
|
||||
std::map<NewcoinAddress, CKey::pointer> mCache;
|
||||
std::map<RippleAddress, CKey::pointer> mCache;
|
||||
|
||||
public:
|
||||
PubKeyCache() { ; }
|
||||
|
||||
CKey::pointer locate(const NewcoinAddress& id);
|
||||
CKey::pointer store(const NewcoinAddress& id, const CKey::pointer& key);
|
||||
CKey::pointer locate(const RippleAddress& id);
|
||||
CKey::pointer store(const RippleAddress& id, const CKey::pointer& key);
|
||||
void clear();
|
||||
};
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "Log.h"
|
||||
#include "RippleLines.h"
|
||||
#include "Wallet.h"
|
||||
#include "NewcoinAddress.h"
|
||||
#include "RippleAddress.h"
|
||||
#include "AccountState.h"
|
||||
#include "NicknameState.h"
|
||||
|
||||
@@ -133,11 +133,11 @@ bool RPCHandler::extractString(std::string& param, const Json::Value& params, in
|
||||
// Look up the master public generator for a regular seed so we may index source accounts ids.
|
||||
// --> naRegularSeed
|
||||
// <-- naMasterGenerator
|
||||
Json::Value RPCHandler::getMasterGenerator(const uint256& uLedger, const NewcoinAddress& naRegularSeed, NewcoinAddress& naMasterGenerator)
|
||||
Json::Value RPCHandler::getMasterGenerator(const uint256& uLedger, const RippleAddress& naRegularSeed, RippleAddress& naMasterGenerator)
|
||||
{
|
||||
NewcoinAddress na0Public; // To find the generator's index.
|
||||
NewcoinAddress na0Private; // To decrypt the master generator's cipher.
|
||||
NewcoinAddress naGenerator = NewcoinAddress::createGeneratorPublic(naRegularSeed);
|
||||
RippleAddress na0Public; // To find the generator's index.
|
||||
RippleAddress na0Private; // To decrypt the master generator's cipher.
|
||||
RippleAddress naGenerator = RippleAddress::createGeneratorPublic(naRegularSeed);
|
||||
|
||||
na0Public.setAccountPublic(naGenerator, 0);
|
||||
na0Private.setAccountPrivate(naGenerator, naRegularSeed, 0);
|
||||
@@ -172,10 +172,10 @@ Json::Value RPCHandler::getMasterGenerator(const uint256& uLedger, const Newcoin
|
||||
// --> naVerifyGenerator : If provided, the found master public generator must match.
|
||||
// XXX Be more lenient, allow use of master generator on claimed accounts.
|
||||
Json::Value RPCHandler::authorize(const uint256& uLedger,
|
||||
const NewcoinAddress& naRegularSeed, const NewcoinAddress& naSrcAccountID,
|
||||
NewcoinAddress& naAccountPublic, NewcoinAddress& naAccountPrivate,
|
||||
const RippleAddress& naRegularSeed, const RippleAddress& naSrcAccountID,
|
||||
RippleAddress& naAccountPublic, RippleAddress& naAccountPrivate,
|
||||
STAmount& saSrcBalance, const STAmount& saFee, AccountState::pointer& asSrc,
|
||||
const NewcoinAddress& naVerifyGenerator)
|
||||
const RippleAddress& naVerifyGenerator)
|
||||
{
|
||||
// Source/paying account must exist.
|
||||
asSrc = mNetOps->getAccountState(uLedger, naSrcAccountID);
|
||||
@@ -184,7 +184,7 @@ Json::Value RPCHandler::authorize(const uint256& uLedger,
|
||||
return rpcError(rpcSRC_ACT_MISSING);
|
||||
}
|
||||
|
||||
NewcoinAddress naMasterGenerator;
|
||||
RippleAddress naMasterGenerator;
|
||||
|
||||
if (asSrc->bHaveAuthorizedKey())
|
||||
{
|
||||
@@ -196,7 +196,7 @@ Json::Value RPCHandler::authorize(const uint256& uLedger,
|
||||
else
|
||||
{
|
||||
// Try the seed as a master seed.
|
||||
naMasterGenerator = NewcoinAddress::createGeneratorPublic(naRegularSeed);
|
||||
naMasterGenerator = RippleAddress::createGeneratorPublic(naRegularSeed);
|
||||
}
|
||||
|
||||
// If naVerifyGenerator is provided, make sure it is the master generator.
|
||||
@@ -206,7 +206,7 @@ Json::Value RPCHandler::authorize(const uint256& uLedger,
|
||||
}
|
||||
|
||||
// Find the index of the account from the master generator, so we can generate the public and private keys.
|
||||
NewcoinAddress naMasterAccountPublic;
|
||||
RippleAddress naMasterAccountPublic;
|
||||
unsigned int iIndex = 0;
|
||||
bool bFound = false;
|
||||
|
||||
@@ -229,7 +229,7 @@ Json::Value RPCHandler::authorize(const uint256& uLedger,
|
||||
}
|
||||
|
||||
// Use the regular generator to determine the associated public and private keys.
|
||||
NewcoinAddress naGenerator = NewcoinAddress::createGeneratorPublic(naRegularSeed);
|
||||
RippleAddress naGenerator = RippleAddress::createGeneratorPublic(naRegularSeed);
|
||||
|
||||
naAccountPublic.setAccountPublic(naGenerator, iIndex);
|
||||
naAccountPrivate.setAccountPrivate(naGenerator, naRegularSeed, iIndex);
|
||||
@@ -261,9 +261,9 @@ Json::Value RPCHandler::authorize(const uint256& uLedger,
|
||||
|
||||
// --> strIdent: public key, account ID, or regular seed.
|
||||
// <-- bIndex: true if iIndex > 0 and used the index.
|
||||
Json::Value RPCHandler::accountFromString(const uint256& uLedger, NewcoinAddress& naAccount, bool& bIndex, const std::string& strIdent, const int iIndex)
|
||||
Json::Value RPCHandler::accountFromString(const uint256& uLedger, RippleAddress& naAccount, bool& bIndex, const std::string& strIdent, const int iIndex)
|
||||
{
|
||||
NewcoinAddress naSeed;
|
||||
RippleAddress naSeed;
|
||||
|
||||
if (naAccount.setAccountPublic(strIdent) || naAccount.setAccountID(strIdent))
|
||||
{
|
||||
@@ -279,10 +279,10 @@ Json::Value RPCHandler::accountFromString(const uint256& uLedger, NewcoinAddress
|
||||
{
|
||||
// We allow the use of the seeds to access #0.
|
||||
// This is poor practice and merely for debuging convenience.
|
||||
NewcoinAddress naRegular0Public;
|
||||
NewcoinAddress naRegular0Private;
|
||||
RippleAddress naRegular0Public;
|
||||
RippleAddress naRegular0Private;
|
||||
|
||||
NewcoinAddress naGenerator = NewcoinAddress::createGeneratorPublic(naSeed);
|
||||
RippleAddress naGenerator = RippleAddress::createGeneratorPublic(naSeed);
|
||||
|
||||
naRegular0Public.setAccountPublic(naGenerator, 0);
|
||||
naRegular0Private.setAccountPrivate(naGenerator, naSeed, 0);
|
||||
@@ -328,8 +328,8 @@ Json::Value RPCHandler::doAcceptLedger(const Json::Value ¶ms)
|
||||
// account_domain_set <seed> <paying_account> [<domain>]
|
||||
Json::Value RPCHandler::doAccountDomainSet(const Json::Value ¶ms)
|
||||
{
|
||||
NewcoinAddress naSrcAccountID;
|
||||
NewcoinAddress naSeed;
|
||||
RippleAddress naSrcAccountID;
|
||||
RippleAddress naSeed;
|
||||
|
||||
if (!naSeed.setSeedGeneric(params[0u].asString()))
|
||||
{
|
||||
@@ -340,9 +340,9 @@ Json::Value RPCHandler::doAccountDomainSet(const Json::Value ¶ms)
|
||||
return rpcError(rpcSRC_ACT_MALFORMED);
|
||||
}
|
||||
|
||||
NewcoinAddress naVerifyGenerator;
|
||||
NewcoinAddress naAccountPublic;
|
||||
NewcoinAddress naAccountPrivate;
|
||||
RippleAddress naVerifyGenerator;
|
||||
RippleAddress naAccountPublic;
|
||||
RippleAddress naAccountPrivate;
|
||||
AccountState::pointer asSrc;
|
||||
STAmount saSrcBalance;
|
||||
Json::Value obj = authorize(uint256(0), naSeed, naSrcAccountID, naAccountPublic, naAccountPrivate,
|
||||
@@ -361,7 +361,7 @@ Json::Value RPCHandler::doAccountDomainSet(const Json::Value ¶ms)
|
||||
uint128(),
|
||||
false,
|
||||
0,
|
||||
NewcoinAddress(),
|
||||
RippleAddress(),
|
||||
true,
|
||||
strCopy(params[2u].asString()),
|
||||
false,
|
||||
@@ -381,8 +381,8 @@ Json::Value RPCHandler::doAccountDomainSet(const Json::Value ¶ms)
|
||||
// account_email_set <seed> <paying_account> [<email_address>]
|
||||
Json::Value RPCHandler::doAccountEmailSet(const Json::Value ¶ms)
|
||||
{
|
||||
NewcoinAddress naSrcAccountID;
|
||||
NewcoinAddress naSeed;
|
||||
RippleAddress naSrcAccountID;
|
||||
RippleAddress naSeed;
|
||||
|
||||
if (!naSeed.setSeedGeneric(params[0u].asString()))
|
||||
{
|
||||
@@ -393,9 +393,9 @@ Json::Value RPCHandler::doAccountEmailSet(const Json::Value ¶ms)
|
||||
return rpcError(rpcSRC_ACT_MALFORMED);
|
||||
}
|
||||
|
||||
NewcoinAddress naVerifyGenerator;
|
||||
NewcoinAddress naAccountPublic;
|
||||
NewcoinAddress naAccountPrivate;
|
||||
RippleAddress naVerifyGenerator;
|
||||
RippleAddress naAccountPublic;
|
||||
RippleAddress naAccountPrivate;
|
||||
AccountState::pointer asSrc;
|
||||
STAmount saSrcBalance;
|
||||
Json::Value obj = authorize(uint256(0), naSeed, naSrcAccountID, naAccountPublic, naAccountPrivate,
|
||||
@@ -425,7 +425,7 @@ Json::Value RPCHandler::doAccountEmailSet(const Json::Value ¶ms)
|
||||
strEmail.empty() ? uint128() : uEmailHash,
|
||||
false,
|
||||
uint256(),
|
||||
NewcoinAddress(),
|
||||
RippleAddress(),
|
||||
false,
|
||||
vucDomain,
|
||||
false,
|
||||
@@ -456,7 +456,7 @@ Json::Value RPCHandler::doAccountInfo(const Json::Value ¶ms)
|
||||
std::string strIdent = params[0u].asString();
|
||||
bool bIndex;
|
||||
int iIndex = 2 == params.size() ? lexical_cast_s<int>(params[1u].asString()) : 0;
|
||||
NewcoinAddress naAccount;
|
||||
RippleAddress naAccount;
|
||||
|
||||
Json::Value ret;
|
||||
|
||||
@@ -503,9 +503,9 @@ Json::Value RPCHandler::doAccountInfo(const Json::Value ¶ms)
|
||||
|
||||
// account_message_set <seed> <paying_account> <pub_key>
|
||||
Json::Value RPCHandler::doAccountMessageSet(const Json::Value& params) {
|
||||
NewcoinAddress naSrcAccountID;
|
||||
NewcoinAddress naSeed;
|
||||
NewcoinAddress naMessagePubKey;
|
||||
RippleAddress naSrcAccountID;
|
||||
RippleAddress naSeed;
|
||||
RippleAddress naMessagePubKey;
|
||||
|
||||
if (!naSeed.setSeedGeneric(params[0u].asString()))
|
||||
{
|
||||
@@ -520,9 +520,9 @@ Json::Value RPCHandler::doAccountMessageSet(const Json::Value& params) {
|
||||
return rpcError(rpcPUBLIC_MALFORMED);
|
||||
}
|
||||
|
||||
NewcoinAddress naVerifyGenerator;
|
||||
NewcoinAddress naAccountPublic;
|
||||
NewcoinAddress naAccountPrivate;
|
||||
RippleAddress naVerifyGenerator;
|
||||
RippleAddress naAccountPublic;
|
||||
RippleAddress naAccountPrivate;
|
||||
AccountState::pointer asSrc;
|
||||
STAmount saSrcBalance;
|
||||
Json::Value obj = authorize(uint256(0), naSeed, naSrcAccountID, naAccountPublic, naAccountPrivate,
|
||||
@@ -563,8 +563,8 @@ Json::Value RPCHandler::doAccountMessageSet(const Json::Value& params) {
|
||||
// account_publish_set <seed> <paying_account> <hash> <size>
|
||||
Json::Value RPCHandler::doAccountPublishSet(const Json::Value ¶ms)
|
||||
{
|
||||
NewcoinAddress naSrcAccountID;
|
||||
NewcoinAddress naSeed;
|
||||
RippleAddress naSrcAccountID;
|
||||
RippleAddress naSeed;
|
||||
|
||||
if (!naSeed.setSeedGeneric(params[0u].asString()))
|
||||
{
|
||||
@@ -575,9 +575,9 @@ Json::Value RPCHandler::doAccountPublishSet(const Json::Value ¶ms)
|
||||
return rpcError(rpcSRC_ACT_MALFORMED);
|
||||
}
|
||||
|
||||
NewcoinAddress naVerifyGenerator;
|
||||
NewcoinAddress naAccountPublic;
|
||||
NewcoinAddress naAccountPrivate;
|
||||
RippleAddress naVerifyGenerator;
|
||||
RippleAddress naAccountPublic;
|
||||
RippleAddress naAccountPrivate;
|
||||
AccountState::pointer asSrc;
|
||||
STAmount saSrcBalance;
|
||||
Json::Value obj = authorize(uint256(0), naSeed, naSrcAccountID, naAccountPublic, naAccountPrivate,
|
||||
@@ -600,7 +600,7 @@ Json::Value RPCHandler::doAccountPublishSet(const Json::Value ¶ms)
|
||||
uint128(),
|
||||
false,
|
||||
0,
|
||||
NewcoinAddress(),
|
||||
RippleAddress(),
|
||||
false,
|
||||
vucDomain,
|
||||
false,
|
||||
@@ -620,8 +620,8 @@ Json::Value RPCHandler::doAccountPublishSet(const Json::Value ¶ms)
|
||||
// account_rate_set <seed> <paying_account> <rate>
|
||||
Json::Value RPCHandler::doAccountRateSet(const Json::Value ¶ms)
|
||||
{
|
||||
NewcoinAddress naSrcAccountID;
|
||||
NewcoinAddress naSeed;
|
||||
RippleAddress naSrcAccountID;
|
||||
RippleAddress naSeed;
|
||||
|
||||
if (!naSeed.setSeedGeneric(params[0u].asString()))
|
||||
{
|
||||
@@ -632,9 +632,9 @@ Json::Value RPCHandler::doAccountRateSet(const Json::Value ¶ms)
|
||||
return rpcError(rpcSRC_ACT_MALFORMED);
|
||||
}
|
||||
|
||||
NewcoinAddress naVerifyGenerator;
|
||||
NewcoinAddress naAccountPublic;
|
||||
NewcoinAddress naAccountPrivate;
|
||||
RippleAddress naVerifyGenerator;
|
||||
RippleAddress naAccountPublic;
|
||||
RippleAddress naAccountPrivate;
|
||||
AccountState::pointer asSrc;
|
||||
STAmount saSrcBalance;
|
||||
Json::Value obj = authorize(uint256(0), naSeed, naSrcAccountID, naAccountPublic, naAccountPrivate,
|
||||
@@ -656,7 +656,7 @@ Json::Value RPCHandler::doAccountRateSet(const Json::Value ¶ms)
|
||||
uint128(),
|
||||
false,
|
||||
0,
|
||||
NewcoinAddress(),
|
||||
RippleAddress(),
|
||||
false,
|
||||
vucDomain,
|
||||
true,
|
||||
@@ -675,8 +675,8 @@ Json::Value RPCHandler::doAccountRateSet(const Json::Value ¶ms)
|
||||
|
||||
// account_wallet_set <seed> <paying_account> [<wallet_hash>]
|
||||
Json::Value RPCHandler::doAccountWalletSet(const Json::Value& params) {
|
||||
NewcoinAddress naSrcAccountID;
|
||||
NewcoinAddress naSeed;
|
||||
RippleAddress naSrcAccountID;
|
||||
RippleAddress naSeed;
|
||||
|
||||
if (!naSeed.setSeedGeneric(params[0u].asString()))
|
||||
{
|
||||
@@ -687,9 +687,9 @@ Json::Value RPCHandler::doAccountWalletSet(const Json::Value& params) {
|
||||
return rpcError(rpcSRC_ACT_MALFORMED);
|
||||
}
|
||||
|
||||
NewcoinAddress naMasterGenerator;
|
||||
NewcoinAddress naAccountPublic;
|
||||
NewcoinAddress naAccountPrivate;
|
||||
RippleAddress naMasterGenerator;
|
||||
RippleAddress naAccountPublic;
|
||||
RippleAddress naAccountPrivate;
|
||||
AccountState::pointer asSrc;
|
||||
STAmount saSrcBalance;
|
||||
Json::Value obj = authorize(uint256(0), naSeed, naSrcAccountID, naAccountPublic, naAccountPrivate,
|
||||
@@ -715,7 +715,7 @@ Json::Value RPCHandler::doAccountWalletSet(const Json::Value& params) {
|
||||
uint128(),
|
||||
true,
|
||||
uWalletLocator,
|
||||
NewcoinAddress(),
|
||||
RippleAddress(),
|
||||
false,
|
||||
vucDomain,
|
||||
false,
|
||||
@@ -850,8 +850,8 @@ Json::Value RPCHandler::doNicknameInfo(const Json::Value& params)
|
||||
// nickname_set <seed> <paying_account> <nickname> [<offer_minimum>] [<authorization>]
|
||||
Json::Value RPCHandler::doNicknameSet(const Json::Value& params)
|
||||
{
|
||||
NewcoinAddress naSrcAccountID;
|
||||
NewcoinAddress naSeed;
|
||||
RippleAddress naSrcAccountID;
|
||||
RippleAddress naSeed;
|
||||
|
||||
if (!naSeed.setSeedGeneric(params[0u].asString()))
|
||||
{
|
||||
@@ -896,9 +896,9 @@ Json::Value RPCHandler::doNicknameSet(const Json::Value& params)
|
||||
saFee = theConfig.FEE_DEFAULT;
|
||||
}
|
||||
|
||||
NewcoinAddress naMasterGenerator;
|
||||
NewcoinAddress naAccountPublic;
|
||||
NewcoinAddress naAccountPrivate;
|
||||
RippleAddress naMasterGenerator;
|
||||
RippleAddress naAccountPublic;
|
||||
RippleAddress naAccountPrivate;
|
||||
AccountState::pointer asSrc;
|
||||
STAmount saSrcBalance;
|
||||
Json::Value obj = authorize(uint256(0), naSeed, naSrcAccountID, naAccountPublic, naAccountPrivate,
|
||||
@@ -932,8 +932,8 @@ Json::Value RPCHandler::doNicknameSet(const Json::Value& params)
|
||||
// *offering* for *wants*
|
||||
Json::Value RPCHandler::doOfferCreate(const Json::Value ¶ms)
|
||||
{
|
||||
NewcoinAddress naSeed;
|
||||
NewcoinAddress naSrcAccountID;
|
||||
RippleAddress naSeed;
|
||||
RippleAddress naSrcAccountID;
|
||||
STAmount saTakerPays;
|
||||
STAmount saTakerGets;
|
||||
|
||||
@@ -961,9 +961,9 @@ Json::Value RPCHandler::doOfferCreate(const Json::Value ¶ms)
|
||||
uint32 uExpiration = lexical_cast_s<int>(params[8u].asString());
|
||||
bool bPassive = params.size() == 10;
|
||||
|
||||
NewcoinAddress naMasterGenerator;
|
||||
NewcoinAddress naAccountPublic;
|
||||
NewcoinAddress naAccountPrivate;
|
||||
RippleAddress naMasterGenerator;
|
||||
RippleAddress naAccountPublic;
|
||||
RippleAddress naAccountPrivate;
|
||||
AccountState::pointer asSrc;
|
||||
STAmount saSrcBalance;
|
||||
Json::Value obj = authorize(uint256(0), naSeed, naSrcAccountID, naAccountPublic, naAccountPrivate,
|
||||
@@ -994,8 +994,8 @@ Json::Value RPCHandler::doOfferCreate(const Json::Value ¶ms)
|
||||
// offer_cancel <seed> <paying_account> <sequence>
|
||||
Json::Value RPCHandler::doOfferCancel(const Json::Value ¶ms)
|
||||
{
|
||||
NewcoinAddress naSeed;
|
||||
NewcoinAddress naSrcAccountID;
|
||||
RippleAddress naSeed;
|
||||
RippleAddress naSrcAccountID;
|
||||
uint32 uSequence = lexical_cast_s<int>(params[2u].asString());
|
||||
|
||||
if (!naSeed.setSeedGeneric(params[0u].asString()))
|
||||
@@ -1007,9 +1007,9 @@ Json::Value RPCHandler::doOfferCancel(const Json::Value ¶ms)
|
||||
return rpcError(rpcSRC_ACT_MALFORMED);
|
||||
}
|
||||
|
||||
NewcoinAddress naMasterGenerator;
|
||||
NewcoinAddress naAccountPublic;
|
||||
NewcoinAddress naAccountPrivate;
|
||||
RippleAddress naMasterGenerator;
|
||||
RippleAddress naAccountPublic;
|
||||
RippleAddress naAccountPrivate;
|
||||
AccountState::pointer asSrc;
|
||||
STAmount saSrcBalance;
|
||||
Json::Value obj = authorize(uint256(0), naSeed, naSrcAccountID, naAccountPublic, naAccountPrivate,
|
||||
@@ -1041,7 +1041,7 @@ Json::Value RPCHandler::doOwnerInfo(const Json::Value& params)
|
||||
std::string strIdent = params[0u].asString();
|
||||
bool bIndex;
|
||||
int iIndex = 2 == params.size() ? lexical_cast_s<int>(params[1u].asString()) : 0;
|
||||
NewcoinAddress naAccount;
|
||||
RippleAddress naAccount;
|
||||
|
||||
Json::Value ret;
|
||||
|
||||
@@ -1062,9 +1062,9 @@ Json::Value RPCHandler::doOwnerInfo(const Json::Value& params)
|
||||
// YYY Make making account default to first account for seed.
|
||||
Json::Value RPCHandler::doPasswordFund(const Json::Value ¶ms)
|
||||
{
|
||||
NewcoinAddress naSrcAccountID;
|
||||
NewcoinAddress naDstAccountID;
|
||||
NewcoinAddress naSeed;
|
||||
RippleAddress naSrcAccountID;
|
||||
RippleAddress naDstAccountID;
|
||||
RippleAddress naSeed;
|
||||
|
||||
if (!naSeed.setSeedGeneric(params[0u].asString()))
|
||||
{
|
||||
@@ -1079,9 +1079,9 @@ Json::Value RPCHandler::doPasswordFund(const Json::Value ¶ms)
|
||||
return rpcError(rpcDST_ACT_MALFORMED);
|
||||
}
|
||||
|
||||
NewcoinAddress naMasterGenerator;
|
||||
NewcoinAddress naAccountPublic;
|
||||
NewcoinAddress naAccountPrivate;
|
||||
RippleAddress naMasterGenerator;
|
||||
RippleAddress naAccountPublic;
|
||||
RippleAddress naAccountPrivate;
|
||||
AccountState::pointer asSrc;
|
||||
STAmount saSrcBalance;
|
||||
Json::Value obj = authorize(uint256(0), naSeed, naSrcAccountID, naAccountPublic, naAccountPrivate,
|
||||
@@ -1111,9 +1111,9 @@ Json::Value RPCHandler::doPasswordFund(const Json::Value ¶ms)
|
||||
// password_set <master_seed> <regular_seed> [<account>]
|
||||
Json::Value RPCHandler::doPasswordSet(const Json::Value& params)
|
||||
{
|
||||
NewcoinAddress naMasterSeed;
|
||||
NewcoinAddress naRegularSeed;
|
||||
NewcoinAddress naAccountID;
|
||||
RippleAddress naMasterSeed;
|
||||
RippleAddress naRegularSeed;
|
||||
RippleAddress naAccountID;
|
||||
|
||||
if (!naMasterSeed.setSeedGeneric(params[0u].asString()))
|
||||
{
|
||||
@@ -1132,13 +1132,13 @@ Json::Value RPCHandler::doPasswordSet(const Json::Value& params)
|
||||
}
|
||||
else
|
||||
{
|
||||
NewcoinAddress naMasterGenerator = NewcoinAddress::createGeneratorPublic(naMasterSeed);
|
||||
NewcoinAddress naRegularGenerator = NewcoinAddress::createGeneratorPublic(naRegularSeed);
|
||||
NewcoinAddress naRegular0Public;
|
||||
NewcoinAddress naRegular0Private;
|
||||
RippleAddress naMasterGenerator = RippleAddress::createGeneratorPublic(naMasterSeed);
|
||||
RippleAddress naRegularGenerator = RippleAddress::createGeneratorPublic(naRegularSeed);
|
||||
RippleAddress naRegular0Public;
|
||||
RippleAddress naRegular0Private;
|
||||
|
||||
NewcoinAddress naAccountPublic;
|
||||
NewcoinAddress naAccountPrivate;
|
||||
RippleAddress naAccountPublic;
|
||||
RippleAddress naAccountPrivate;
|
||||
|
||||
naAccountPublic.setAccountPublic(naMasterGenerator, 0);
|
||||
naAccountPrivate.setAccountPrivate(naMasterGenerator, naMasterSeed, 0);
|
||||
@@ -1155,8 +1155,8 @@ Json::Value RPCHandler::doPasswordSet(const Json::Value& params)
|
||||
// XXX Check result.
|
||||
naRegular0Private.accountPrivateSign(Serializer::getSHA512Half(vucGeneratorCipher), vucGeneratorSig);
|
||||
|
||||
NewcoinAddress naMasterXPublic;
|
||||
NewcoinAddress naRegularXPublic;
|
||||
RippleAddress naMasterXPublic;
|
||||
RippleAddress naRegularXPublic;
|
||||
unsigned int iIndex = -1; // Compensate for initial increment.
|
||||
int iMax = theConfig.ACCOUNT_PROBE_MAX;
|
||||
|
||||
@@ -1219,11 +1219,11 @@ Json::Value RPCHandler::doPeers(const Json::Value& params)
|
||||
Json::Value RPCHandler::doProfile(const Json::Value ¶ms)
|
||||
{
|
||||
int iArgs = params.size();
|
||||
NewcoinAddress naSeedA;
|
||||
NewcoinAddress naAccountA;
|
||||
RippleAddress naSeedA;
|
||||
RippleAddress naAccountA;
|
||||
uint160 uCurrencyOfferA;
|
||||
NewcoinAddress naSeedB;
|
||||
NewcoinAddress naAccountB;
|
||||
RippleAddress naSeedB;
|
||||
RippleAddress naAccountB;
|
||||
uint160 uCurrencyOfferB;
|
||||
uint32 iCount = 100;
|
||||
bool bSubmit = false;
|
||||
@@ -1256,9 +1256,9 @@ Json::Value RPCHandler::doProfile(const Json::Value ¶ms)
|
||||
|
||||
for(unsigned int n=0; n<iCount; n++)
|
||||
{
|
||||
NewcoinAddress naMasterGeneratorA;
|
||||
NewcoinAddress naAccountPublicA;
|
||||
NewcoinAddress naAccountPrivateA;
|
||||
RippleAddress naMasterGeneratorA;
|
||||
RippleAddress naAccountPublicA;
|
||||
RippleAddress naAccountPrivateA;
|
||||
AccountState::pointer asSrcA;
|
||||
STAmount saSrcBalanceA;
|
||||
|
||||
@@ -1314,16 +1314,16 @@ Json::Value RPCHandler::doProfile(const Json::Value ¶ms)
|
||||
// offer <currency> [<issuerID>]
|
||||
Json::Value RPCHandler::doRipple(const Json::Value ¶ms)
|
||||
{
|
||||
NewcoinAddress naSeed;
|
||||
RippleAddress naSeed;
|
||||
STAmount saSrcAmountMax;
|
||||
uint160 uSrcCurrencyID;
|
||||
NewcoinAddress naSrcAccountID;
|
||||
NewcoinAddress naSrcIssuerID;
|
||||
RippleAddress naSrcAccountID;
|
||||
RippleAddress naSrcIssuerID;
|
||||
bool bPartial;
|
||||
bool bFull;
|
||||
bool bLimit;
|
||||
bool bAverage;
|
||||
NewcoinAddress naDstAccountID;
|
||||
RippleAddress naDstAccountID;
|
||||
STAmount saDstAmount;
|
||||
uint160 uDstCurrencyID;
|
||||
|
||||
@@ -1367,7 +1367,7 @@ Json::Value RPCHandler::doRipple(const Json::Value ¶ms)
|
||||
{
|
||||
Log(lsINFO) << "Offer>";
|
||||
uint160 uCurrencyID;
|
||||
NewcoinAddress naIssuerID;
|
||||
RippleAddress naIssuerID;
|
||||
|
||||
++iArg;
|
||||
|
||||
@@ -1388,9 +1388,9 @@ Json::Value RPCHandler::doRipple(const Json::Value ¶ms)
|
||||
else if (params.size() >= iArg + 2 && params[iArg].asString() == "account") // account
|
||||
{
|
||||
Log(lsINFO) << "Account>";
|
||||
NewcoinAddress naAccountID;
|
||||
RippleAddress naAccountID;
|
||||
uint160 uCurrencyID;
|
||||
NewcoinAddress naIssuerID;
|
||||
RippleAddress naIssuerID;
|
||||
|
||||
++iArg;
|
||||
|
||||
@@ -1483,9 +1483,9 @@ Json::Value RPCHandler::doRipple(const Json::Value ¶ms)
|
||||
AccountState::pointer asDst = mNetOps->getAccountState(uint256(0), naDstAccountID);
|
||||
STAmount saFee = theConfig.FEE_DEFAULT;
|
||||
|
||||
NewcoinAddress naVerifyGenerator;
|
||||
NewcoinAddress naAccountPublic;
|
||||
NewcoinAddress naAccountPrivate;
|
||||
RippleAddress naVerifyGenerator;
|
||||
RippleAddress naAccountPublic;
|
||||
RippleAddress naAccountPrivate;
|
||||
AccountState::pointer asSrc;
|
||||
STAmount saSrcBalance;
|
||||
Json::Value obj = authorize(uint256(0), naSeed, naSrcAccountID, naAccountPublic, naAccountPrivate,
|
||||
@@ -1537,9 +1537,9 @@ Json::Value RPCHandler::doRipple(const Json::Value ¶ms)
|
||||
// ripple_line_set <seed> <paying_account> <destination_account> <limit_amount> [<currency>] [<quality_in>] [<quality_out>]
|
||||
Json::Value RPCHandler::doRippleLineSet(const Json::Value& params)
|
||||
{
|
||||
NewcoinAddress naSeed;
|
||||
NewcoinAddress naSrcAccountID;
|
||||
NewcoinAddress naDstAccountID;
|
||||
RippleAddress naSeed;
|
||||
RippleAddress naSrcAccountID;
|
||||
RippleAddress naDstAccountID;
|
||||
STAmount saLimitAmount;
|
||||
bool bQualityIn = params.size() >= 6;
|
||||
bool bQualityOut = params.size() >= 7;
|
||||
@@ -1572,9 +1572,9 @@ Json::Value RPCHandler::doRippleLineSet(const Json::Value& params)
|
||||
}
|
||||
else
|
||||
{
|
||||
NewcoinAddress naMasterGenerator;
|
||||
NewcoinAddress naAccountPublic;
|
||||
NewcoinAddress naAccountPrivate;
|
||||
RippleAddress naMasterGenerator;
|
||||
RippleAddress naAccountPublic;
|
||||
RippleAddress naAccountPrivate;
|
||||
AccountState::pointer asSrc;
|
||||
STAmount saSrcBalance;
|
||||
Json::Value obj = authorize(uint256(0), naSeed, naSrcAccountID, naAccountPublic, naAccountPrivate,
|
||||
@@ -1614,7 +1614,7 @@ Json::Value RPCHandler::doRippleLinesGet(const Json::Value ¶ms)
|
||||
bool bIndex;
|
||||
int iIndex = 2 == params.size() ? lexical_cast_s<int>(params[1u].asString()) : 0;
|
||||
|
||||
NewcoinAddress naAccount;
|
||||
RippleAddress naAccount;
|
||||
|
||||
Json::Value ret;
|
||||
|
||||
@@ -1683,9 +1683,9 @@ Json::Value RPCHandler::doSubmit(const Json::Value& params)
|
||||
// send regular_seed paying_account account_id amount [currency] [issuer] [send_max] [send_currency] [send_issuer]
|
||||
Json::Value RPCHandler::doSend(const Json::Value& params)
|
||||
{
|
||||
NewcoinAddress naSeed;
|
||||
NewcoinAddress naSrcAccountID;
|
||||
NewcoinAddress naDstAccountID;
|
||||
RippleAddress naSeed;
|
||||
RippleAddress naSrcAccountID;
|
||||
RippleAddress naDstAccountID;
|
||||
STAmount saSrcAmountMax;
|
||||
STAmount saDstAmount;
|
||||
std::string sSrcCurrency;
|
||||
@@ -1731,9 +1731,9 @@ Json::Value RPCHandler::doSend(const Json::Value& params)
|
||||
bool bCreate = !asDst;
|
||||
STAmount saFee = bCreate ? theConfig.FEE_ACCOUNT_CREATE : theConfig.FEE_DEFAULT;
|
||||
|
||||
NewcoinAddress naVerifyGenerator;
|
||||
NewcoinAddress naAccountPublic;
|
||||
NewcoinAddress naAccountPrivate;
|
||||
RippleAddress naVerifyGenerator;
|
||||
RippleAddress naAccountPublic;
|
||||
RippleAddress naAccountPrivate;
|
||||
AccountState::pointer asSrc;
|
||||
STAmount saSrcBalance;
|
||||
Json::Value obj = authorize(uint256(0), naSeed, naSrcAccountID, naAccountPublic, naAccountPrivate,
|
||||
@@ -1948,7 +1948,7 @@ Json::Value RPCHandler::doAccountTransactions(const Json::Value& params)
|
||||
if (!extractString(param, params, 0))
|
||||
return rpcError(rpcINVALID_PARAMS);
|
||||
|
||||
NewcoinAddress account;
|
||||
RippleAddress account;
|
||||
if (!account.setAccountID(param))
|
||||
return rpcError(rpcACT_MALFORMED);
|
||||
|
||||
@@ -2009,7 +2009,7 @@ Json::Value RPCHandler::doUnlAdd(const Json::Value& params)
|
||||
std::string strNode = params[0u].asString();
|
||||
std::string strComment = (params.size() == 2) ? params[1u].asString() : "";
|
||||
|
||||
NewcoinAddress naNodePublic;
|
||||
RippleAddress naNodePublic;
|
||||
|
||||
if (naNodePublic.setNodePublic(strNode))
|
||||
{
|
||||
@@ -2030,7 +2030,7 @@ Json::Value RPCHandler::doUnlAdd(const Json::Value& params)
|
||||
// NOTE: It is poor security to specify secret information on the command line. This information might be saved in the command
|
||||
// shell history file (e.g. .bash_history) and it may be leaked via the process status command (i.e. ps).
|
||||
Json::Value RPCHandler::doValidationCreate(const Json::Value& params) {
|
||||
NewcoinAddress naSeed;
|
||||
RippleAddress naSeed;
|
||||
Json::Value obj(Json::objectValue);
|
||||
|
||||
if (params.empty())
|
||||
@@ -2044,7 +2044,7 @@ Json::Value RPCHandler::doValidationCreate(const Json::Value& params) {
|
||||
return rpcError(rpcBAD_SEED);
|
||||
}
|
||||
|
||||
obj["validation_public_key"] = NewcoinAddress::createNodePublic(naSeed).humanNodePublic();
|
||||
obj["validation_public_key"] = RippleAddress::createNodePublic(naSeed).humanNodePublic();
|
||||
obj["validation_seed"] = naSeed.humanSeed();
|
||||
obj["validation_key"] = naSeed.humanSeed1751();
|
||||
|
||||
@@ -2070,7 +2070,7 @@ Json::Value RPCHandler::doValidationSeed(const Json::Value& params) {
|
||||
}
|
||||
else
|
||||
{
|
||||
obj["validation_public_key"] = NewcoinAddress::createNodePublic(theConfig.VALIDATION_SEED).humanNodePublic();
|
||||
obj["validation_public_key"] = RippleAddress::createNodePublic(theConfig.VALIDATION_SEED).humanNodePublic();
|
||||
obj["validation_seed"] = theConfig.VALIDATION_SEED.humanSeed();
|
||||
obj["validation_key"] = theConfig.VALIDATION_SEED.humanSeed1751();
|
||||
}
|
||||
@@ -2078,7 +2078,7 @@ Json::Value RPCHandler::doValidationSeed(const Json::Value& params) {
|
||||
return obj;
|
||||
}
|
||||
|
||||
Json::Value RPCHandler::accounts(const uint256& uLedger, const NewcoinAddress& naMasterGenerator)
|
||||
Json::Value RPCHandler::accounts(const uint256& uLedger, const RippleAddress& naMasterGenerator)
|
||||
{
|
||||
Json::Value jsonAccounts(Json::arrayValue);
|
||||
|
||||
@@ -2087,7 +2087,7 @@ Json::Value RPCHandler::accounts(const uint256& uLedger, const NewcoinAddress& n
|
||||
unsigned int uIndex = 0;
|
||||
|
||||
do {
|
||||
NewcoinAddress naAccount;
|
||||
RippleAddress naAccount;
|
||||
|
||||
naAccount.setAccountPublic(naMasterGenerator, uIndex++);
|
||||
|
||||
@@ -2112,7 +2112,7 @@ Json::Value RPCHandler::accounts(const uint256& uLedger, const NewcoinAddress& n
|
||||
// wallet_accounts <seed>
|
||||
Json::Value RPCHandler::doWalletAccounts(const Json::Value& params)
|
||||
{
|
||||
NewcoinAddress naSeed;
|
||||
RippleAddress naSeed;
|
||||
|
||||
if (!naSeed.setSeedGeneric(params[0u].asString()))
|
||||
{
|
||||
@@ -2120,7 +2120,7 @@ Json::Value RPCHandler::doWalletAccounts(const Json::Value& params)
|
||||
}
|
||||
|
||||
// Try the seed as a master seed.
|
||||
NewcoinAddress naMasterGenerator = NewcoinAddress::createGeneratorPublic(naSeed);
|
||||
RippleAddress naMasterGenerator = RippleAddress::createGeneratorPublic(naSeed);
|
||||
|
||||
Json::Value jsonAccounts = accounts(uint256(0), naMasterGenerator);
|
||||
|
||||
@@ -2150,9 +2150,9 @@ Json::Value RPCHandler::doWalletAccounts(const Json::Value& params)
|
||||
// wallet_add <regular_seed> <paying_account> <master_seed> [<initial_funds>] [<account_annotation>]
|
||||
Json::Value RPCHandler::doWalletAdd(const Json::Value& params)
|
||||
{
|
||||
NewcoinAddress naMasterSeed;
|
||||
NewcoinAddress naRegularSeed;
|
||||
NewcoinAddress naSrcAccountID;
|
||||
RippleAddress naMasterSeed;
|
||||
RippleAddress naRegularSeed;
|
||||
RippleAddress naSrcAccountID;
|
||||
STAmount saAmount;
|
||||
std::string sDstCurrency;
|
||||
|
||||
@@ -2174,11 +2174,11 @@ Json::Value RPCHandler::doWalletAdd(const Json::Value& params)
|
||||
}
|
||||
else
|
||||
{
|
||||
NewcoinAddress naMasterGenerator = NewcoinAddress::createGeneratorPublic(naMasterSeed);
|
||||
NewcoinAddress naRegularGenerator = NewcoinAddress::createGeneratorPublic(naRegularSeed);
|
||||
RippleAddress naMasterGenerator = RippleAddress::createGeneratorPublic(naMasterSeed);
|
||||
RippleAddress naRegularGenerator = RippleAddress::createGeneratorPublic(naRegularSeed);
|
||||
|
||||
NewcoinAddress naAccountPublic;
|
||||
NewcoinAddress naAccountPrivate;
|
||||
RippleAddress naAccountPublic;
|
||||
RippleAddress naAccountPrivate;
|
||||
AccountState::pointer asSrc;
|
||||
STAmount saSrcBalance;
|
||||
Json::Value obj = authorize(uint256(0), naRegularSeed, naSrcAccountID, naAccountPublic, naAccountPrivate,
|
||||
@@ -2193,9 +2193,9 @@ Json::Value RPCHandler::doWalletAdd(const Json::Value& params)
|
||||
}
|
||||
else
|
||||
{
|
||||
NewcoinAddress naNewAccountPublic;
|
||||
NewcoinAddress naNewAccountPrivate;
|
||||
NewcoinAddress naAuthKeyID;
|
||||
RippleAddress naNewAccountPublic;
|
||||
RippleAddress naNewAccountPrivate;
|
||||
RippleAddress naAuthKeyID;
|
||||
uint160 uAuthKeyID;
|
||||
AccountState::pointer asNew;
|
||||
std::vector<unsigned char> vucSignature;
|
||||
@@ -2254,8 +2254,8 @@ Json::Value RPCHandler::doWalletAdd(const Json::Value& params)
|
||||
// To provide an example to client writers, we do everything we expect a client to do here.
|
||||
Json::Value RPCHandler::doWalletClaim(const Json::Value& params)
|
||||
{
|
||||
NewcoinAddress naMasterSeed;
|
||||
NewcoinAddress naRegularSeed;
|
||||
RippleAddress naMasterSeed;
|
||||
RippleAddress naRegularSeed;
|
||||
|
||||
if (!naMasterSeed.setSeedGeneric(params[0u].asString()))
|
||||
{
|
||||
@@ -2281,13 +2281,13 @@ Json::Value RPCHandler::doWalletClaim(const Json::Value& params)
|
||||
// XXX Annotation is ignored.
|
||||
std::string strAnnotation = (params.size() == 3) ? "" : params[3u].asString();
|
||||
|
||||
NewcoinAddress naMasterGenerator = NewcoinAddress::createGeneratorPublic(naMasterSeed);
|
||||
NewcoinAddress naRegularGenerator = NewcoinAddress::createGeneratorPublic(naRegularSeed);
|
||||
NewcoinAddress naRegular0Public;
|
||||
NewcoinAddress naRegular0Private;
|
||||
RippleAddress naMasterGenerator = RippleAddress::createGeneratorPublic(naMasterSeed);
|
||||
RippleAddress naRegularGenerator = RippleAddress::createGeneratorPublic(naRegularSeed);
|
||||
RippleAddress naRegular0Public;
|
||||
RippleAddress naRegular0Private;
|
||||
|
||||
NewcoinAddress naAccountPublic;
|
||||
NewcoinAddress naAccountPrivate;
|
||||
RippleAddress naAccountPublic;
|
||||
RippleAddress naAccountPrivate;
|
||||
|
||||
naAccountPublic.setAccountPublic(naMasterGenerator, 0);
|
||||
naAccountPrivate.setAccountPrivate(naMasterGenerator, naMasterSeed, 0);
|
||||
@@ -2339,9 +2339,9 @@ Json::Value RPCHandler::doWalletClaim(const Json::Value& params)
|
||||
// YYY Need annotation and source tag
|
||||
Json::Value RPCHandler::doWalletCreate(const Json::Value& params)
|
||||
{
|
||||
NewcoinAddress naSrcAccountID;
|
||||
NewcoinAddress naDstAccountID;
|
||||
NewcoinAddress naSeed;
|
||||
RippleAddress naSrcAccountID;
|
||||
RippleAddress naDstAccountID;
|
||||
RippleAddress naSeed;
|
||||
|
||||
if (!naSeed.setSeedGeneric(params[0u].asString()))
|
||||
{
|
||||
@@ -2363,9 +2363,9 @@ Json::Value RPCHandler::doWalletCreate(const Json::Value& params)
|
||||
// Trying to build:
|
||||
// peer_wallet_create <paying_account> <paying_signature> <account_id> [<initial_funds>] [<annotation>]
|
||||
|
||||
NewcoinAddress naMasterGenerator;
|
||||
NewcoinAddress naAccountPublic;
|
||||
NewcoinAddress naAccountPrivate;
|
||||
RippleAddress naMasterGenerator;
|
||||
RippleAddress naAccountPublic;
|
||||
RippleAddress naAccountPrivate;
|
||||
AccountState::pointer asSrc;
|
||||
STAmount saSrcBalance;
|
||||
Json::Value obj = authorize(uint256(0), naSeed, naSrcAccountID, naAccountPublic, naAccountPrivate,
|
||||
@@ -2521,8 +2521,8 @@ Json::Value RPCHandler::doCommand(const std::string& command, Json::Value& param
|
||||
// <passphrase> is only for testing. Master seeds should only be generated randomly.
|
||||
Json::Value RPCHandler::doWalletPropose(const Json::Value& params)
|
||||
{
|
||||
NewcoinAddress naSeed;
|
||||
NewcoinAddress naAccount;
|
||||
RippleAddress naSeed;
|
||||
RippleAddress naAccount;
|
||||
|
||||
if (params.empty())
|
||||
{
|
||||
@@ -2530,10 +2530,10 @@ Json::Value RPCHandler::doWalletPropose(const Json::Value& params)
|
||||
}
|
||||
else
|
||||
{
|
||||
naSeed = NewcoinAddress::createSeedGeneric(params[0u].asString());
|
||||
naSeed = RippleAddress::createSeedGeneric(params[0u].asString());
|
||||
}
|
||||
|
||||
NewcoinAddress naGenerator = NewcoinAddress::createGeneratorPublic(naSeed);
|
||||
RippleAddress naGenerator = RippleAddress::createGeneratorPublic(naSeed);
|
||||
naAccount.setAccountPublic(naGenerator, 0);
|
||||
|
||||
Json::Value obj(Json::objectValue);
|
||||
@@ -2548,7 +2548,7 @@ Json::Value RPCHandler::doWalletPropose(const Json::Value& params)
|
||||
// wallet_seed [<seed>|<passphrase>|<passkey>]
|
||||
Json::Value RPCHandler::doWalletSeed(const Json::Value& params)
|
||||
{
|
||||
NewcoinAddress naSeed;
|
||||
RippleAddress naSeed;
|
||||
|
||||
if (params.size()
|
||||
&& !naSeed.setSeedGeneric(params[0u].asString()))
|
||||
@@ -2557,14 +2557,14 @@ Json::Value RPCHandler::doWalletSeed(const Json::Value& params)
|
||||
}
|
||||
else
|
||||
{
|
||||
NewcoinAddress naAccount;
|
||||
RippleAddress naAccount;
|
||||
|
||||
if (!params.size())
|
||||
{
|
||||
naSeed.setSeedRandom();
|
||||
}
|
||||
|
||||
NewcoinAddress naGenerator = NewcoinAddress::createGeneratorPublic(naSeed);
|
||||
RippleAddress naGenerator = RippleAddress::createGeneratorPublic(naSeed);
|
||||
|
||||
naAccount.setAccountPublic(naGenerator, 0);
|
||||
|
||||
@@ -2675,7 +2675,7 @@ Json::Value RPCHandler::doUnlDelete(const Json::Value& params)
|
||||
{
|
||||
std::string strNode = params[0u].asString();
|
||||
|
||||
NewcoinAddress naNodePublic;
|
||||
RippleAddress naNodePublic;
|
||||
|
||||
if (naNodePublic.setNodePublic(strNode))
|
||||
{
|
||||
|
||||
@@ -15,14 +15,14 @@ class RPCHandler
|
||||
int getParamCount(const Json::Value& params);
|
||||
bool extractString(std::string& param, const Json::Value& params, int index);
|
||||
|
||||
Json::Value getMasterGenerator(const uint256& uLedger, const NewcoinAddress& naRegularSeed, NewcoinAddress& naMasterGenerator);
|
||||
Json::Value authorize(const uint256& uLedger, const NewcoinAddress& naRegularSeed, const NewcoinAddress& naSrcAccountID,
|
||||
NewcoinAddress& naAccountPublic, NewcoinAddress& naAccountPrivate,
|
||||
Json::Value getMasterGenerator(const uint256& uLedger, const RippleAddress& naRegularSeed, RippleAddress& naMasterGenerator);
|
||||
Json::Value authorize(const uint256& uLedger, const RippleAddress& naRegularSeed, const RippleAddress& naSrcAccountID,
|
||||
RippleAddress& naAccountPublic, RippleAddress& naAccountPrivate,
|
||||
STAmount& saSrcBalance, const STAmount& saFee, AccountState::pointer& asSrc,
|
||||
const NewcoinAddress& naVerifyGenerator);
|
||||
Json::Value accounts(const uint256& uLedger, const NewcoinAddress& naMasterGenerator);
|
||||
const RippleAddress& naVerifyGenerator);
|
||||
Json::Value accounts(const uint256& uLedger, const RippleAddress& naMasterGenerator);
|
||||
|
||||
Json::Value accountFromString(const uint256& uLedger, NewcoinAddress& naAccount, bool& bIndex, const std::string& strIdent, const int iIndex);
|
||||
Json::Value accountFromString(const uint256& uLedger, RippleAddress& naAccount, bool& bIndex, const std::string& strIdent, const int iIndex);
|
||||
|
||||
Json::Value doAcceptLedger(const Json::Value ¶ms);
|
||||
Json::Value doAccountDomainSet(const Json::Value ¶ms);
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "../json/value.h"
|
||||
|
||||
#include "HTTPRequest.h"
|
||||
#include "NewcoinAddress.h"
|
||||
#include "RippleAddress.h"
|
||||
#include "NetworkOPs.h"
|
||||
#include "SerializedLedger.h"
|
||||
#include "RPCHandler.h"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "NewcoinAddress.h"
|
||||
#include "RippleAddress.h"
|
||||
#include "key.h"
|
||||
#include "Config.h"
|
||||
#include "BitcoinUtil.h"
|
||||
@@ -13,12 +13,12 @@
|
||||
#include <iostream>
|
||||
#include <openssl/rand.h>
|
||||
|
||||
NewcoinAddress::NewcoinAddress()
|
||||
RippleAddress::RippleAddress()
|
||||
{
|
||||
nVersion = VER_NONE;
|
||||
}
|
||||
|
||||
bool NewcoinAddress::isValid() const
|
||||
bool RippleAddress::isValid() const
|
||||
{
|
||||
bool bValid = false;
|
||||
|
||||
@@ -48,13 +48,13 @@ bool NewcoinAddress::isValid() const
|
||||
return bValid;
|
||||
}
|
||||
|
||||
void NewcoinAddress::clear()
|
||||
void RippleAddress::clear()
|
||||
{
|
||||
nVersion = VER_NONE;
|
||||
vchData.clear();
|
||||
}
|
||||
|
||||
std::string NewcoinAddress::humanAddressType() const
|
||||
std::string RippleAddress::humanAddressType() const
|
||||
{
|
||||
switch (nVersion)
|
||||
{
|
||||
@@ -75,10 +75,10 @@ std::string NewcoinAddress::humanAddressType() const
|
||||
// NodePublic
|
||||
//
|
||||
|
||||
NewcoinAddress NewcoinAddress::createNodePublic(const NewcoinAddress& naSeed)
|
||||
RippleAddress RippleAddress::createNodePublic(const RippleAddress& naSeed)
|
||||
{
|
||||
CKey ckSeed(naSeed.getSeed());
|
||||
NewcoinAddress naNew;
|
||||
RippleAddress naNew;
|
||||
|
||||
// YYY Should there be a GetPubKey() equiv that returns a uint256?
|
||||
naNew.setNodePublic(ckSeed.GetPubKey());
|
||||
@@ -86,25 +86,25 @@ NewcoinAddress NewcoinAddress::createNodePublic(const NewcoinAddress& naSeed)
|
||||
return naNew;
|
||||
}
|
||||
|
||||
NewcoinAddress NewcoinAddress::createNodePublic(const std::vector<unsigned char>& vPublic)
|
||||
RippleAddress RippleAddress::createNodePublic(const std::vector<unsigned char>& vPublic)
|
||||
{
|
||||
NewcoinAddress naNew;
|
||||
RippleAddress naNew;
|
||||
|
||||
naNew.setNodePublic(vPublic);
|
||||
|
||||
return naNew;
|
||||
}
|
||||
|
||||
NewcoinAddress NewcoinAddress::createNodePublic(const std::string& strPublic)
|
||||
RippleAddress RippleAddress::createNodePublic(const std::string& strPublic)
|
||||
{
|
||||
NewcoinAddress naNew;
|
||||
RippleAddress naNew;
|
||||
|
||||
naNew.setNodePublic(strPublic);
|
||||
|
||||
return naNew;
|
||||
}
|
||||
|
||||
uint160 NewcoinAddress::getNodeID() const
|
||||
uint160 RippleAddress::getNodeID() const
|
||||
{
|
||||
switch (nVersion) {
|
||||
case VER_NONE:
|
||||
@@ -118,7 +118,7 @@ uint160 NewcoinAddress::getNodeID() const
|
||||
throw std::runtime_error(str(boost::format("bad source: %d") % int(nVersion)));
|
||||
}
|
||||
}
|
||||
const std::vector<unsigned char>& NewcoinAddress::getNodePublic() const
|
||||
const std::vector<unsigned char>& RippleAddress::getNodePublic() const
|
||||
{
|
||||
switch (nVersion) {
|
||||
case VER_NONE:
|
||||
@@ -132,7 +132,7 @@ const std::vector<unsigned char>& NewcoinAddress::getNodePublic() const
|
||||
}
|
||||
}
|
||||
|
||||
std::string NewcoinAddress::humanNodePublic() const
|
||||
std::string RippleAddress::humanNodePublic() const
|
||||
{
|
||||
switch (nVersion) {
|
||||
case VER_NONE:
|
||||
@@ -146,17 +146,17 @@ std::string NewcoinAddress::humanNodePublic() const
|
||||
}
|
||||
}
|
||||
|
||||
bool NewcoinAddress::setNodePublic(const std::string& strPublic)
|
||||
bool RippleAddress::setNodePublic(const std::string& strPublic)
|
||||
{
|
||||
return SetString(strPublic.c_str(), VER_NODE_PUBLIC);
|
||||
}
|
||||
|
||||
void NewcoinAddress::setNodePublic(const std::vector<unsigned char>& vPublic)
|
||||
void RippleAddress::setNodePublic(const std::vector<unsigned char>& vPublic)
|
||||
{
|
||||
SetData(VER_NODE_PUBLIC, vPublic);
|
||||
}
|
||||
|
||||
bool NewcoinAddress::verifyNodePublic(const uint256& hash, const std::vector<unsigned char>& vchSig) const
|
||||
bool RippleAddress::verifyNodePublic(const uint256& hash, const std::vector<unsigned char>& vchSig) const
|
||||
{
|
||||
CKey pubkey = CKey();
|
||||
bool bVerified;
|
||||
@@ -174,7 +174,7 @@ bool NewcoinAddress::verifyNodePublic(const uint256& hash, const std::vector<uns
|
||||
return bVerified;
|
||||
}
|
||||
|
||||
bool NewcoinAddress::verifyNodePublic(const uint256& hash, const std::string& strSig) const
|
||||
bool RippleAddress::verifyNodePublic(const uint256& hash, const std::string& strSig) const
|
||||
{
|
||||
std::vector<unsigned char> vchSig(strSig.begin(), strSig.end());
|
||||
|
||||
@@ -185,10 +185,10 @@ bool NewcoinAddress::verifyNodePublic(const uint256& hash, const std::string& st
|
||||
// NodePrivate
|
||||
//
|
||||
|
||||
NewcoinAddress NewcoinAddress::createNodePrivate(const NewcoinAddress& naSeed)
|
||||
RippleAddress RippleAddress::createNodePrivate(const RippleAddress& naSeed)
|
||||
{
|
||||
uint256 uPrivKey;
|
||||
NewcoinAddress naNew;
|
||||
RippleAddress naNew;
|
||||
CKey ckSeed(naSeed.getSeed());
|
||||
|
||||
ckSeed.GetPrivateKeyU(uPrivKey);
|
||||
@@ -198,7 +198,7 @@ NewcoinAddress NewcoinAddress::createNodePrivate(const NewcoinAddress& naSeed)
|
||||
return naNew;
|
||||
}
|
||||
|
||||
const std::vector<unsigned char>& NewcoinAddress::getNodePrivateData() const
|
||||
const std::vector<unsigned char>& RippleAddress::getNodePrivateData() const
|
||||
{
|
||||
switch (nVersion) {
|
||||
case VER_NONE:
|
||||
@@ -212,7 +212,7 @@ const std::vector<unsigned char>& NewcoinAddress::getNodePrivateData() const
|
||||
}
|
||||
}
|
||||
|
||||
uint256 NewcoinAddress::getNodePrivate() const
|
||||
uint256 RippleAddress::getNodePrivate() const
|
||||
{
|
||||
switch (nVersion) {
|
||||
case VER_NONE:
|
||||
@@ -226,7 +226,7 @@ uint256 NewcoinAddress::getNodePrivate() const
|
||||
}
|
||||
}
|
||||
|
||||
std::string NewcoinAddress::humanNodePrivate() const
|
||||
std::string RippleAddress::humanNodePrivate() const
|
||||
{
|
||||
switch (nVersion) {
|
||||
case VER_NONE:
|
||||
@@ -240,21 +240,21 @@ std::string NewcoinAddress::humanNodePrivate() const
|
||||
}
|
||||
}
|
||||
|
||||
bool NewcoinAddress::setNodePrivate(const std::string& strPrivate)
|
||||
bool RippleAddress::setNodePrivate(const std::string& strPrivate)
|
||||
{
|
||||
return SetString(strPrivate.c_str(), VER_NODE_PRIVATE);
|
||||
}
|
||||
|
||||
void NewcoinAddress::setNodePrivate(const std::vector<unsigned char>& vPrivate) {
|
||||
void RippleAddress::setNodePrivate(const std::vector<unsigned char>& vPrivate) {
|
||||
SetData(VER_NODE_PRIVATE, vPrivate);
|
||||
}
|
||||
|
||||
void NewcoinAddress::setNodePrivate(uint256 hash256)
|
||||
void RippleAddress::setNodePrivate(uint256 hash256)
|
||||
{
|
||||
SetData(VER_NODE_PRIVATE, hash256.begin(), 32);
|
||||
}
|
||||
|
||||
void NewcoinAddress::signNodePrivate(const uint256& hash, std::vector<unsigned char>& vchSig) const
|
||||
void RippleAddress::signNodePrivate(const uint256& hash, std::vector<unsigned char>& vchSig) const
|
||||
{
|
||||
CKey ckPrivKey;
|
||||
|
||||
@@ -268,7 +268,7 @@ void NewcoinAddress::signNodePrivate(const uint256& hash, std::vector<unsigned c
|
||||
// AccountID
|
||||
//
|
||||
|
||||
uint160 NewcoinAddress::getAccountID() const
|
||||
uint160 RippleAddress::getAccountID() const
|
||||
{
|
||||
switch (nVersion) {
|
||||
case VER_NONE:
|
||||
@@ -286,7 +286,7 @@ uint160 NewcoinAddress::getAccountID() const
|
||||
}
|
||||
}
|
||||
|
||||
std::string NewcoinAddress::humanAccountID() const
|
||||
std::string RippleAddress::humanAccountID() const
|
||||
{
|
||||
switch (nVersion) {
|
||||
case VER_NONE:
|
||||
@@ -297,7 +297,7 @@ std::string NewcoinAddress::humanAccountID() const
|
||||
|
||||
case VER_ACCOUNT_PUBLIC:
|
||||
{
|
||||
NewcoinAddress accountID;
|
||||
RippleAddress accountID;
|
||||
|
||||
(void) accountID.setAccountID(getAccountID());
|
||||
|
||||
@@ -309,7 +309,7 @@ std::string NewcoinAddress::humanAccountID() const
|
||||
}
|
||||
}
|
||||
|
||||
bool NewcoinAddress::setAccountID(const std::string& strAccountID)
|
||||
bool RippleAddress::setAccountID(const std::string& strAccountID)
|
||||
{
|
||||
if (strAccountID.empty())
|
||||
{
|
||||
@@ -323,7 +323,7 @@ bool NewcoinAddress::setAccountID(const std::string& strAccountID)
|
||||
}
|
||||
}
|
||||
|
||||
void NewcoinAddress::setAccountID(const uint160& hash160)
|
||||
void RippleAddress::setAccountID(const uint160& hash160)
|
||||
{
|
||||
SetData(VER_ACCOUNT_ID, hash160.begin(), 20);
|
||||
}
|
||||
@@ -332,17 +332,17 @@ void NewcoinAddress::setAccountID(const uint160& hash160)
|
||||
// AccountPublic
|
||||
//
|
||||
|
||||
NewcoinAddress NewcoinAddress::createAccountPublic(const NewcoinAddress& naGenerator, int iSeq)
|
||||
RippleAddress RippleAddress::createAccountPublic(const RippleAddress& naGenerator, int iSeq)
|
||||
{
|
||||
CKey ckPub(naGenerator, iSeq);
|
||||
NewcoinAddress naNew;
|
||||
RippleAddress naNew;
|
||||
|
||||
naNew.setAccountPublic(ckPub.GetPubKey());
|
||||
|
||||
return naNew;
|
||||
}
|
||||
|
||||
const std::vector<unsigned char>& NewcoinAddress::getAccountPublic() const
|
||||
const std::vector<unsigned char>& RippleAddress::getAccountPublic() const
|
||||
{
|
||||
switch (nVersion) {
|
||||
case VER_NONE:
|
||||
@@ -360,7 +360,7 @@ const std::vector<unsigned char>& NewcoinAddress::getAccountPublic() const
|
||||
}
|
||||
}
|
||||
|
||||
std::string NewcoinAddress::humanAccountPublic() const
|
||||
std::string RippleAddress::humanAccountPublic() const
|
||||
{
|
||||
switch (nVersion) {
|
||||
case VER_NONE:
|
||||
@@ -377,24 +377,24 @@ std::string NewcoinAddress::humanAccountPublic() const
|
||||
}
|
||||
}
|
||||
|
||||
bool NewcoinAddress::setAccountPublic(const std::string& strPublic)
|
||||
bool RippleAddress::setAccountPublic(const std::string& strPublic)
|
||||
{
|
||||
return SetString(strPublic.c_str(), VER_ACCOUNT_PUBLIC);
|
||||
}
|
||||
|
||||
void NewcoinAddress::setAccountPublic(const std::vector<unsigned char>& vPublic)
|
||||
void RippleAddress::setAccountPublic(const std::vector<unsigned char>& vPublic)
|
||||
{
|
||||
SetData(VER_ACCOUNT_PUBLIC, vPublic);
|
||||
}
|
||||
|
||||
void NewcoinAddress::setAccountPublic(const NewcoinAddress& generator, int seq)
|
||||
void RippleAddress::setAccountPublic(const RippleAddress& generator, int seq)
|
||||
{
|
||||
CKey pubkey = CKey(generator, seq);
|
||||
|
||||
setAccountPublic(pubkey.GetPubKey());
|
||||
}
|
||||
|
||||
bool NewcoinAddress::accountPublicVerify(const uint256& uHash, const std::vector<unsigned char>& vucSig) const
|
||||
bool RippleAddress::accountPublicVerify(const uint256& uHash, const std::vector<unsigned char>& vucSig) const
|
||||
{
|
||||
CKey ckPublic;
|
||||
bool bVerified;
|
||||
@@ -413,9 +413,9 @@ bool NewcoinAddress::accountPublicVerify(const uint256& uHash, const std::vector
|
||||
return bVerified;
|
||||
}
|
||||
|
||||
NewcoinAddress NewcoinAddress::createAccountID(const uint160& uiAccountID)
|
||||
RippleAddress RippleAddress::createAccountID(const uint160& uiAccountID)
|
||||
{
|
||||
NewcoinAddress na;
|
||||
RippleAddress na;
|
||||
|
||||
na.setAccountID(uiAccountID);
|
||||
|
||||
@@ -426,16 +426,16 @@ NewcoinAddress NewcoinAddress::createAccountID(const uint160& uiAccountID)
|
||||
// AccountPrivate
|
||||
//
|
||||
|
||||
NewcoinAddress NewcoinAddress::createAccountPrivate(const NewcoinAddress& naGenerator, const NewcoinAddress& naSeed, int iSeq)
|
||||
RippleAddress RippleAddress::createAccountPrivate(const RippleAddress& naGenerator, const RippleAddress& naSeed, int iSeq)
|
||||
{
|
||||
NewcoinAddress naNew;
|
||||
RippleAddress naNew;
|
||||
|
||||
naNew.setAccountPrivate(naGenerator, naSeed, iSeq);
|
||||
|
||||
return naNew;
|
||||
}
|
||||
|
||||
uint256 NewcoinAddress::getAccountPrivate() const
|
||||
uint256 RippleAddress::getAccountPrivate() const
|
||||
{
|
||||
switch (nVersion) {
|
||||
case VER_NONE:
|
||||
@@ -449,7 +449,7 @@ uint256 NewcoinAddress::getAccountPrivate() const
|
||||
}
|
||||
}
|
||||
|
||||
std::string NewcoinAddress::humanAccountPrivate() const
|
||||
std::string RippleAddress::humanAccountPrivate() const
|
||||
{
|
||||
switch (nVersion) {
|
||||
case VER_NONE:
|
||||
@@ -463,22 +463,22 @@ std::string NewcoinAddress::humanAccountPrivate() const
|
||||
}
|
||||
}
|
||||
|
||||
bool NewcoinAddress::setAccountPrivate(const std::string& strPrivate)
|
||||
bool RippleAddress::setAccountPrivate(const std::string& strPrivate)
|
||||
{
|
||||
return SetString(strPrivate.c_str(), VER_ACCOUNT_PRIVATE);
|
||||
}
|
||||
|
||||
void NewcoinAddress::setAccountPrivate(const std::vector<unsigned char>& vPrivate)
|
||||
void RippleAddress::setAccountPrivate(const std::vector<unsigned char>& vPrivate)
|
||||
{
|
||||
SetData(VER_ACCOUNT_PRIVATE, vPrivate);
|
||||
}
|
||||
|
||||
void NewcoinAddress::setAccountPrivate(uint256 hash256)
|
||||
void RippleAddress::setAccountPrivate(uint256 hash256)
|
||||
{
|
||||
SetData(VER_ACCOUNT_PRIVATE, hash256.begin(), 32);
|
||||
}
|
||||
|
||||
void NewcoinAddress::setAccountPrivate(const NewcoinAddress& naGenerator, const NewcoinAddress& naSeed, int seq)
|
||||
void RippleAddress::setAccountPrivate(const RippleAddress& naGenerator, const RippleAddress& naSeed, int seq)
|
||||
{
|
||||
CKey ckPubkey = CKey(naSeed.getSeed());
|
||||
CKey ckPrivkey = CKey(naGenerator, ckPubkey.GetSecretBN(), seq);
|
||||
@@ -489,7 +489,7 @@ void NewcoinAddress::setAccountPrivate(const NewcoinAddress& naGenerator, const
|
||||
setAccountPrivate(uPrivKey);
|
||||
}
|
||||
|
||||
bool NewcoinAddress::accountPrivateSign(const uint256& uHash, std::vector<unsigned char>& vucSig) const
|
||||
bool RippleAddress::accountPrivateSign(const uint256& uHash, std::vector<unsigned char>& vucSig) const
|
||||
{
|
||||
CKey ckPrivate;
|
||||
bool bResult;
|
||||
@@ -511,7 +511,7 @@ bool NewcoinAddress::accountPrivateSign(const uint256& uHash, std::vector<unsign
|
||||
}
|
||||
|
||||
#if 0
|
||||
bool NewcoinAddress::accountPrivateVerify(const uint256& uHash, const std::vector<unsigned char>& vucSig) const
|
||||
bool RippleAddress::accountPrivateVerify(const uint256& uHash, const std::vector<unsigned char>& vucSig) const
|
||||
{
|
||||
CKey ckPrivate;
|
||||
bool bVerified;
|
||||
@@ -531,7 +531,7 @@ bool NewcoinAddress::accountPrivateVerify(const uint256& uHash, const std::vecto
|
||||
}
|
||||
#endif
|
||||
|
||||
std::vector<unsigned char> NewcoinAddress::accountPrivateEncrypt(const NewcoinAddress& naPublicTo, const std::vector<unsigned char>& vucPlainText) const
|
||||
std::vector<unsigned char> RippleAddress::accountPrivateEncrypt(const RippleAddress& naPublicTo, const std::vector<unsigned char>& vucPlainText) const
|
||||
{
|
||||
CKey ckPrivate;
|
||||
CKey ckPublic;
|
||||
@@ -561,7 +561,7 @@ std::vector<unsigned char> NewcoinAddress::accountPrivateEncrypt(const NewcoinAd
|
||||
return vucCipherText;
|
||||
}
|
||||
|
||||
std::vector<unsigned char> NewcoinAddress::accountPrivateDecrypt(const NewcoinAddress& naPublicFrom, const std::vector<unsigned char>& vucCipherText) const
|
||||
std::vector<unsigned char> RippleAddress::accountPrivateDecrypt(const RippleAddress& naPublicFrom, const std::vector<unsigned char>& vucCipherText) const
|
||||
{
|
||||
CKey ckPrivate;
|
||||
CKey ckPublic;
|
||||
@@ -595,7 +595,7 @@ std::vector<unsigned char> NewcoinAddress::accountPrivateDecrypt(const NewcoinAd
|
||||
// Generators
|
||||
//
|
||||
|
||||
BIGNUM* NewcoinAddress::getGeneratorBN() const
|
||||
BIGNUM* RippleAddress::getGeneratorBN() const
|
||||
{ // returns the public generator
|
||||
switch (nVersion) {
|
||||
case VER_NONE:
|
||||
@@ -614,7 +614,7 @@ BIGNUM* NewcoinAddress::getGeneratorBN() const
|
||||
return ret;
|
||||
}
|
||||
|
||||
const std::vector<unsigned char>& NewcoinAddress::getGenerator() const
|
||||
const std::vector<unsigned char>& RippleAddress::getGenerator() const
|
||||
{ // returns the public generator
|
||||
switch (nVersion) {
|
||||
case VER_NONE:
|
||||
@@ -629,7 +629,7 @@ const std::vector<unsigned char>& NewcoinAddress::getGenerator() const
|
||||
}
|
||||
}
|
||||
|
||||
std::string NewcoinAddress::humanGenerator() const
|
||||
std::string RippleAddress::humanGenerator() const
|
||||
{
|
||||
switch (nVersion) {
|
||||
case VER_NONE:
|
||||
@@ -643,20 +643,20 @@ std::string NewcoinAddress::humanGenerator() const
|
||||
}
|
||||
}
|
||||
|
||||
bool NewcoinAddress::setGenerator(const std::string& strGenerator)
|
||||
bool RippleAddress::setGenerator(const std::string& strGenerator)
|
||||
{
|
||||
return SetString(strGenerator.c_str(), VER_FAMILY_GENERATOR);
|
||||
}
|
||||
|
||||
void NewcoinAddress::setGenerator(const std::vector<unsigned char>& vPublic)
|
||||
void RippleAddress::setGenerator(const std::vector<unsigned char>& vPublic)
|
||||
{
|
||||
SetData(VER_FAMILY_GENERATOR, vPublic);
|
||||
}
|
||||
|
||||
NewcoinAddress NewcoinAddress::createGeneratorPublic(const NewcoinAddress& naSeed)
|
||||
RippleAddress RippleAddress::createGeneratorPublic(const RippleAddress& naSeed)
|
||||
{
|
||||
CKey ckSeed(naSeed.getSeed());
|
||||
NewcoinAddress naNew;
|
||||
RippleAddress naNew;
|
||||
|
||||
naNew.setGenerator(ckSeed.GetPubKey());
|
||||
|
||||
@@ -667,7 +667,7 @@ NewcoinAddress NewcoinAddress::createGeneratorPublic(const NewcoinAddress& naSee
|
||||
// Seed
|
||||
//
|
||||
|
||||
uint128 NewcoinAddress::getSeed() const
|
||||
uint128 RippleAddress::getSeed() const
|
||||
{
|
||||
switch (nVersion) {
|
||||
case VER_NONE:
|
||||
@@ -681,7 +681,7 @@ uint128 NewcoinAddress::getSeed() const
|
||||
}
|
||||
}
|
||||
|
||||
std::string NewcoinAddress::humanSeed1751() const
|
||||
std::string RippleAddress::humanSeed1751() const
|
||||
{
|
||||
switch (nVersion) {
|
||||
case VER_NONE:
|
||||
@@ -708,7 +708,7 @@ std::string NewcoinAddress::humanSeed1751() const
|
||||
}
|
||||
}
|
||||
|
||||
std::string NewcoinAddress::humanSeed() const
|
||||
std::string RippleAddress::humanSeed() const
|
||||
{
|
||||
switch (nVersion) {
|
||||
case VER_NONE:
|
||||
@@ -722,7 +722,7 @@ std::string NewcoinAddress::humanSeed() const
|
||||
}
|
||||
}
|
||||
|
||||
int NewcoinAddress::setSeed1751(const std::string& strHuman1751)
|
||||
int RippleAddress::setSeed1751(const std::string& strHuman1751)
|
||||
{
|
||||
std::string strKey;
|
||||
int iResult = eng2key(strKey, strHuman1751);
|
||||
@@ -738,14 +738,14 @@ int NewcoinAddress::setSeed1751(const std::string& strHuman1751)
|
||||
return iResult;
|
||||
}
|
||||
|
||||
bool NewcoinAddress::setSeed(const std::string& strSeed)
|
||||
bool RippleAddress::setSeed(const std::string& strSeed)
|
||||
{
|
||||
return SetString(strSeed.c_str(), VER_FAMILY_SEED);
|
||||
}
|
||||
|
||||
bool NewcoinAddress::setSeedGeneric(const std::string& strText)
|
||||
bool RippleAddress::setSeedGeneric(const std::string& strText)
|
||||
{
|
||||
NewcoinAddress naTemp;
|
||||
RippleAddress naTemp;
|
||||
bool bResult = true;
|
||||
|
||||
if (strText.empty()
|
||||
@@ -776,32 +776,32 @@ bool NewcoinAddress::setSeedGeneric(const std::string& strText)
|
||||
return bResult;
|
||||
}
|
||||
|
||||
void NewcoinAddress::setSeed(uint128 hash128) {
|
||||
void RippleAddress::setSeed(uint128 hash128) {
|
||||
SetData(VER_FAMILY_SEED, hash128.begin(), 16);
|
||||
}
|
||||
|
||||
void NewcoinAddress::setSeedRandom()
|
||||
void RippleAddress::setSeedRandom()
|
||||
{
|
||||
// XXX Maybe we should call MakeNewKey
|
||||
uint128 key;
|
||||
|
||||
RAND_bytes((unsigned char *) &key, sizeof(key));
|
||||
|
||||
NewcoinAddress::setSeed(key);
|
||||
RippleAddress::setSeed(key);
|
||||
}
|
||||
|
||||
NewcoinAddress NewcoinAddress::createSeedRandom()
|
||||
RippleAddress RippleAddress::createSeedRandom()
|
||||
{
|
||||
NewcoinAddress naNew;
|
||||
RippleAddress naNew;
|
||||
|
||||
naNew.setSeedRandom();
|
||||
|
||||
return naNew;
|
||||
}
|
||||
|
||||
NewcoinAddress NewcoinAddress::createSeedGeneric(const std::string& strText)
|
||||
RippleAddress RippleAddress::createSeedGeneric(const std::string& strText)
|
||||
{
|
||||
NewcoinAddress naNew;
|
||||
RippleAddress naNew;
|
||||
|
||||
naNew.setSeedGeneric(strText);
|
||||
|
||||
@@ -813,14 +813,14 @@ BOOST_AUTO_TEST_SUITE(ripple_address)
|
||||
BOOST_AUTO_TEST_CASE( check_crypto )
|
||||
{
|
||||
// Construct a seed.
|
||||
NewcoinAddress naSeed;
|
||||
RippleAddress naSeed;
|
||||
|
||||
BOOST_CHECK(naSeed.setSeedGeneric("masterpassphrase"));
|
||||
BOOST_CHECK_MESSAGE(naSeed.humanSeed() == "snoPBrXtMeMyMHUVTgbuqAfg1SUTb", naSeed.humanSeed());
|
||||
|
||||
// Create node public/private key pair
|
||||
NewcoinAddress naNodePublic = NewcoinAddress::createNodePublic(naSeed);
|
||||
NewcoinAddress naNodePrivate = NewcoinAddress::createNodePrivate(naSeed);
|
||||
RippleAddress naNodePublic = RippleAddress::createNodePublic(naSeed);
|
||||
RippleAddress naNodePrivate = RippleAddress::createNodePrivate(naSeed);
|
||||
|
||||
BOOST_CHECK_MESSAGE(naNodePublic.humanNodePublic() == "n94a1u4jAz288pZLtw6yFWVbi89YamiC6JBXPVUj5zmExe5fTVg9", naNodePublic.humanNodePublic());
|
||||
BOOST_CHECK_MESSAGE(naNodePrivate.humanNodePrivate() == "pnen77YEeUd4fFKG7iycBWcwKpTaeFRkW2WFostaATy1DSupwXe", naNodePrivate.humanNodePrivate());
|
||||
@@ -834,21 +834,21 @@ BOOST_AUTO_TEST_CASE( check_crypto )
|
||||
BOOST_CHECK_MESSAGE(naNodePublic.verifyNodePublic(uHash, vucTextSig), "Verify failed.");
|
||||
|
||||
// Construct a public generator from the seed.
|
||||
NewcoinAddress naGenerator = NewcoinAddress::createGeneratorPublic(naSeed);
|
||||
RippleAddress naGenerator = RippleAddress::createGeneratorPublic(naSeed);
|
||||
|
||||
BOOST_CHECK_MESSAGE(naGenerator.humanGenerator() == "fhuJKrhSDzV2SkjLn9qbwm5AaRmrxDPfFsHDCP6yfDZWcxDFz4mt", naGenerator.humanGenerator());
|
||||
|
||||
// Create account #0 public/private key pair.
|
||||
NewcoinAddress naAccountPublic0 = NewcoinAddress::createAccountPublic(naGenerator, 0);
|
||||
NewcoinAddress naAccountPrivate0 = NewcoinAddress::createAccountPrivate(naGenerator, naSeed, 0);
|
||||
RippleAddress naAccountPublic0 = RippleAddress::createAccountPublic(naGenerator, 0);
|
||||
RippleAddress naAccountPrivate0 = RippleAddress::createAccountPrivate(naGenerator, naSeed, 0);
|
||||
|
||||
BOOST_CHECK_MESSAGE(naAccountPublic0.humanAccountID() == "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh", naAccountPublic0.humanAccountID());
|
||||
BOOST_CHECK_MESSAGE(naAccountPublic0.humanAccountPublic() == "aBQG8RQAzjs1eTKFEAQXr2gS4utcDiEC9wmi7pfUPTi27VCahwgw", naAccountPublic0.humanAccountPublic());
|
||||
BOOST_CHECK_MESSAGE(naAccountPrivate0.humanAccountPrivate() == "p9JfM6HHi64m6mvB6v5k7G2b1cXzGmYiCNJf6GHPKvFTWdeRVjh", naAccountPrivate0.humanAccountPrivate());
|
||||
|
||||
// Create account #1 public/private key pair.
|
||||
NewcoinAddress naAccountPublic1 = NewcoinAddress::createAccountPublic(naGenerator, 1);
|
||||
NewcoinAddress naAccountPrivate1 = NewcoinAddress::createAccountPrivate(naGenerator, naSeed, 1);
|
||||
RippleAddress naAccountPublic1 = RippleAddress::createAccountPublic(naGenerator, 1);
|
||||
RippleAddress naAccountPrivate1 = RippleAddress::createAccountPrivate(naGenerator, naSeed, 1);
|
||||
|
||||
BOOST_CHECK_MESSAGE(naAccountPublic1.humanAccountID() == "r4bYF7SLUMD7QgSLLpgJx38WJSY12ViRjP", naAccountPublic1.humanAccountID());
|
||||
BOOST_CHECK_MESSAGE(naAccountPublic1.humanAccountPublic() == "aBPXpTfuLy1Bhk3HnGTTAqnovpKWQ23NpFMNkAF6F1Atg5vDyPrw", naAccountPublic1.humanAccountPublic());
|
||||
@@ -8,7 +8,7 @@
|
||||
// Used to hold addresses and parse and produce human formats.
|
||||
//
|
||||
// XXX This needs to be reworked to store data in uint160 and uint256. Conversion to CBase58Data should happen as needed.
|
||||
class NewcoinAddress : public CBase58Data
|
||||
class RippleAddress : public CBase58Data
|
||||
{
|
||||
private:
|
||||
typedef enum {
|
||||
@@ -23,7 +23,7 @@ private:
|
||||
} VersionEncoding;
|
||||
|
||||
public:
|
||||
NewcoinAddress();
|
||||
RippleAddress();
|
||||
|
||||
// For public and private key, checks if they are legal.
|
||||
bool isValid() const;
|
||||
@@ -44,9 +44,9 @@ public:
|
||||
bool verifyNodePublic(const uint256& hash, const std::vector<unsigned char>& vchSig) const;
|
||||
bool verifyNodePublic(const uint256& hash, const std::string& strSig) const;
|
||||
|
||||
static NewcoinAddress createNodePublic(const NewcoinAddress& naSeed);
|
||||
static NewcoinAddress createNodePublic(const std::vector<unsigned char>& vPublic);
|
||||
static NewcoinAddress createNodePublic(const std::string& strPublic);
|
||||
static RippleAddress createNodePublic(const RippleAddress& naSeed);
|
||||
static RippleAddress createNodePublic(const std::vector<unsigned char>& vPublic);
|
||||
static RippleAddress createNodePublic(const std::string& strPublic);
|
||||
|
||||
//
|
||||
// Node Private
|
||||
@@ -61,7 +61,7 @@ public:
|
||||
void setNodePrivate(uint256 hash256);
|
||||
void signNodePrivate(const uint256& hash, std::vector<unsigned char>& vchSig) const;
|
||||
|
||||
static NewcoinAddress createNodePrivate(const NewcoinAddress& naSeed);
|
||||
static RippleAddress createNodePrivate(const RippleAddress& naSeed);
|
||||
|
||||
//
|
||||
// Accounts IDs
|
||||
@@ -73,10 +73,10 @@ public:
|
||||
bool setAccountID(const std::string& strAccountID);
|
||||
void setAccountID(const uint160& hash160In);
|
||||
|
||||
static NewcoinAddress createAccountID(const std::string& strAccountID)
|
||||
{ NewcoinAddress na; na.setAccountID(strAccountID); return na; }
|
||||
static RippleAddress createAccountID(const std::string& strAccountID)
|
||||
{ RippleAddress na; na.setAccountID(strAccountID); return na; }
|
||||
|
||||
static NewcoinAddress createAccountID(const uint160& uiAccountID);
|
||||
static RippleAddress createAccountID(const uint160& uiAccountID);
|
||||
|
||||
static std::string createHumanAccountID(const uint160& uiAccountID)
|
||||
{ return createAccountID(uiAccountID).humanAccountID(); }
|
||||
@@ -93,13 +93,13 @@ public:
|
||||
|
||||
bool setAccountPublic(const std::string& strPublic);
|
||||
void setAccountPublic(const std::vector<unsigned char>& vPublic);
|
||||
void setAccountPublic(const NewcoinAddress& generator, int seq);
|
||||
void setAccountPublic(const RippleAddress& generator, int seq);
|
||||
|
||||
bool accountPublicVerify(const uint256& uHash, const std::vector<unsigned char>& vucSig) const;
|
||||
|
||||
static NewcoinAddress createAccountPublic(const std::vector<unsigned char>& vPublic)
|
||||
static RippleAddress createAccountPublic(const std::vector<unsigned char>& vPublic)
|
||||
{
|
||||
NewcoinAddress naNew;
|
||||
RippleAddress naNew;
|
||||
|
||||
naNew.setAccountPublic(vPublic);
|
||||
|
||||
@@ -111,7 +111,7 @@ public:
|
||||
}
|
||||
|
||||
// Create a deterministic public key from a public generator.
|
||||
static NewcoinAddress createAccountPublic(const NewcoinAddress& naGenerator, int iSeq);
|
||||
static RippleAddress createAccountPublic(const RippleAddress& naGenerator, int iSeq);
|
||||
|
||||
//
|
||||
// Accounts Private
|
||||
@@ -123,22 +123,22 @@ public:
|
||||
bool setAccountPrivate(const std::string& strPrivate);
|
||||
void setAccountPrivate(const std::vector<unsigned char>& vPrivate);
|
||||
void setAccountPrivate(uint256 hash256);
|
||||
void setAccountPrivate(const NewcoinAddress& naGenerator, const NewcoinAddress& naSeed, int seq);
|
||||
void setAccountPrivate(const RippleAddress& naGenerator, const RippleAddress& naSeed, int seq);
|
||||
|
||||
bool accountPrivateSign(const uint256& uHash, std::vector<unsigned char>& vucSig) const;
|
||||
// bool accountPrivateVerify(const uint256& uHash, const std::vector<unsigned char>& vucSig) const;
|
||||
|
||||
// Encrypt a message.
|
||||
std::vector<unsigned char> accountPrivateEncrypt(const NewcoinAddress& naPublicTo, const std::vector<unsigned char>& vucPlainText) const;
|
||||
std::vector<unsigned char> accountPrivateEncrypt(const RippleAddress& naPublicTo, const std::vector<unsigned char>& vucPlainText) const;
|
||||
|
||||
// Decrypt a message.
|
||||
std::vector<unsigned char> accountPrivateDecrypt(const NewcoinAddress& naPublicFrom, const std::vector<unsigned char>& vucCipherText) const;
|
||||
std::vector<unsigned char> accountPrivateDecrypt(const RippleAddress& naPublicFrom, const std::vector<unsigned char>& vucCipherText) const;
|
||||
|
||||
static NewcoinAddress createAccountPrivate(const NewcoinAddress& naGenerator, const NewcoinAddress& naSeed, int iSeq);
|
||||
static RippleAddress createAccountPrivate(const RippleAddress& naGenerator, const RippleAddress& naSeed, int iSeq);
|
||||
|
||||
static NewcoinAddress createAccountPrivate(const std::vector<unsigned char>& vPrivate)
|
||||
static RippleAddress createAccountPrivate(const std::vector<unsigned char>& vPrivate)
|
||||
{
|
||||
NewcoinAddress naNew;
|
||||
RippleAddress naNew;
|
||||
|
||||
naNew.setAccountPrivate(vPrivate);
|
||||
|
||||
@@ -160,10 +160,10 @@ public:
|
||||
|
||||
bool setGenerator(const std::string& strGenerator);
|
||||
void setGenerator(const std::vector<unsigned char>& vPublic);
|
||||
// void setGenerator(const NewcoinAddress& seed);
|
||||
// void setGenerator(const RippleAddress& seed);
|
||||
|
||||
// Create generator for making public deterministic keys.
|
||||
static NewcoinAddress createGeneratorPublic(const NewcoinAddress& naSeed);
|
||||
static RippleAddress createGeneratorPublic(const RippleAddress& naSeed);
|
||||
|
||||
//
|
||||
// Seeds
|
||||
@@ -179,8 +179,8 @@ public:
|
||||
void setSeed(uint128 hash128);
|
||||
void setSeedRandom();
|
||||
|
||||
static NewcoinAddress createSeedRandom();
|
||||
static NewcoinAddress createSeedGeneric(const std::string& strText);
|
||||
static RippleAddress createSeedRandom();
|
||||
static RippleAddress createSeedGeneric(const std::string& strText);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -159,7 +159,7 @@ TER RippleCalc::calcNodeAdvance(
|
||||
|
||||
const aciSource asLine = boost::make_tuple(uOfrOwnerID, uCurCurrencyID, uCurIssuerID);
|
||||
|
||||
cLog(lsINFO) << boost::str(boost::format("calcNodeAdvance: uOfrOwnerID=%s") % NewcoinAddress::createHumanAccountID(uOfrOwnerID));
|
||||
cLog(lsINFO) << boost::str(boost::format("calcNodeAdvance: uOfrOwnerID=%s") % RippleAddress::createHumanAccountID(uOfrOwnerID));
|
||||
|
||||
if (sleOffer->isFieldPresent(sfExpiration) && sleOffer->getFieldU32(sfExpiration) <= lesActive.getLedger()->getParentCloseTimeNC())
|
||||
{
|
||||
@@ -236,9 +236,9 @@ TER RippleCalc::calcNodeAdvance(
|
||||
{
|
||||
// Consider source mentioned by current path state.
|
||||
cLog(lsINFO) << boost::str(boost::format("calcNodeAdvance: remember=%s/%s/%s")
|
||||
% NewcoinAddress::createHumanAccountID(uOfrOwnerID)
|
||||
% RippleAddress::createHumanAccountID(uOfrOwnerID)
|
||||
% STAmount::createHumanCurrency(uCurCurrencyID)
|
||||
% NewcoinAddress::createHumanAccountID(uCurIssuerID));
|
||||
% RippleAddress::createHumanAccountID(uCurIssuerID));
|
||||
|
||||
pspCur->umReverse.insert(std::make_pair(asLine, uIndex));
|
||||
}
|
||||
@@ -311,9 +311,9 @@ TER RippleCalc::calcNodeDeliverRev(
|
||||
? saOne // No fee.
|
||||
: saTransferRate; // Transfer rate of issuer.
|
||||
cLog(lsINFO) << boost::str(boost::format("calcNodeDeliverRev: uOfrOwnerID=%s uOutAccountID=%s uCurIssuerID=%s saTransferRate=%s saOutFeeRate=%s")
|
||||
% NewcoinAddress::createHumanAccountID(uOfrOwnerID)
|
||||
% NewcoinAddress::createHumanAccountID(uOutAccountID)
|
||||
% NewcoinAddress::createHumanAccountID(uCurIssuerID)
|
||||
% RippleAddress::createHumanAccountID(uOfrOwnerID)
|
||||
% RippleAddress::createHumanAccountID(uOutAccountID)
|
||||
% RippleAddress::createHumanAccountID(uCurIssuerID)
|
||||
% saTransferRate.getFullText()
|
||||
% saOutFeeRate.getFullText());
|
||||
|
||||
@@ -829,9 +829,9 @@ TER RippleCalc::calcNodeAccountRev(const unsigned int uIndex, PathState::ref psp
|
||||
cLog(lsINFO) << boost::str(boost::format("calcNodeAccountRev> uIndex=%d/%d uPrvAccountID=%s uCurAccountID=%s uNxtAccountID=%s uCurrencyID=%s uQualityIn=%d uQualityOut=%d saPrvOwed=%s saPrvLimit=%s")
|
||||
% uIndex
|
||||
% uLast
|
||||
% NewcoinAddress::createHumanAccountID(uPrvAccountID)
|
||||
% NewcoinAddress::createHumanAccountID(uCurAccountID)
|
||||
% NewcoinAddress::createHumanAccountID(uNxtAccountID)
|
||||
% RippleAddress::createHumanAccountID(uPrvAccountID)
|
||||
% RippleAddress::createHumanAccountID(uCurAccountID)
|
||||
% RippleAddress::createHumanAccountID(uNxtAccountID)
|
||||
% STAmount::createHumanCurrency(uCurrencyID)
|
||||
% uQualityIn
|
||||
% uQualityOut
|
||||
@@ -1215,8 +1215,8 @@ TER RippleCalc::calcNodeAccountFwd(
|
||||
{
|
||||
// account --> ACCOUNT --> $
|
||||
cLog(lsINFO) << boost::str(boost::format("calcNodeAccountFwd: account --> ACCOUNT --> $ : uPrvAccountID=%s uCurAccountID=%s saPrvRedeemReq=%s saPrvIssueReq=%s")
|
||||
% NewcoinAddress::createHumanAccountID(uPrvAccountID)
|
||||
% NewcoinAddress::createHumanAccountID(uCurAccountID)
|
||||
% RippleAddress::createHumanAccountID(uPrvAccountID)
|
||||
% RippleAddress::createHumanAccountID(uCurAccountID)
|
||||
% saPrvRedeemReq.getFullText()
|
||||
% saPrvIssueReq.getFullText());
|
||||
|
||||
@@ -1391,9 +1391,9 @@ TER PathState::pushImply(
|
||||
TER terResult = tesSUCCESS;
|
||||
|
||||
cLog(lsINFO) << "pushImply> "
|
||||
<< NewcoinAddress::createHumanAccountID(uAccountID)
|
||||
<< RippleAddress::createHumanAccountID(uAccountID)
|
||||
<< " " << STAmount::createHumanCurrency(uCurrencyID)
|
||||
<< " " << NewcoinAddress::createHumanAccountID(uIssuerID);
|
||||
<< " " << RippleAddress::createHumanAccountID(uIssuerID);
|
||||
|
||||
if (pnPrv.uCurrencyID != uCurrencyID)
|
||||
{
|
||||
@@ -1437,9 +1437,9 @@ TER PathState::pushNode(
|
||||
const uint160& uIssuerID)
|
||||
{
|
||||
cLog(lsINFO) << "pushNode> "
|
||||
<< NewcoinAddress::createHumanAccountID(uAccountID)
|
||||
<< RippleAddress::createHumanAccountID(uAccountID)
|
||||
<< " " << STAmount::createHumanCurrency(uCurrencyID)
|
||||
<< "/" << NewcoinAddress::createHumanAccountID(uIssuerID);
|
||||
<< "/" << RippleAddress::createHumanAccountID(uIssuerID);
|
||||
PaymentNode pnCur;
|
||||
const bool bFirst = vpnNodes.empty();
|
||||
const PaymentNode& pnPrv = bFirst ? PaymentNode() : vpnNodes.back();
|
||||
@@ -1491,9 +1491,9 @@ TER PathState::pushNode(
|
||||
if (!sleRippleState)
|
||||
{
|
||||
cLog(lsINFO) << "pushNode: No credit line between "
|
||||
<< NewcoinAddress::createHumanAccountID(pnBck.uAccountID)
|
||||
<< RippleAddress::createHumanAccountID(pnBck.uAccountID)
|
||||
<< " and "
|
||||
<< NewcoinAddress::createHumanAccountID(pnCur.uAccountID)
|
||||
<< RippleAddress::createHumanAccountID(pnCur.uAccountID)
|
||||
<< " for "
|
||||
<< STAmount::createHumanCurrency(pnPrv.uCurrencyID)
|
||||
<< "." ;
|
||||
@@ -1505,9 +1505,9 @@ TER PathState::pushNode(
|
||||
else
|
||||
{
|
||||
cLog(lsINFO) << "pushNode: Credit line found between "
|
||||
<< NewcoinAddress::createHumanAccountID(pnBck.uAccountID)
|
||||
<< RippleAddress::createHumanAccountID(pnBck.uAccountID)
|
||||
<< " and "
|
||||
<< NewcoinAddress::createHumanAccountID(pnCur.uAccountID)
|
||||
<< RippleAddress::createHumanAccountID(pnCur.uAccountID)
|
||||
<< " for "
|
||||
<< STAmount::createHumanCurrency(pnPrv.uCurrencyID)
|
||||
<< "." ;
|
||||
@@ -1633,9 +1633,9 @@ PathState::PathState(
|
||||
|
||||
cLog(lsINFO) << boost::str(boost::format("PathState: in=%s/%s out=%s/%s %s")
|
||||
% STAmount::createHumanCurrency(uInCurrencyID)
|
||||
% NewcoinAddress::createHumanAccountID(uInIssuerID)
|
||||
% RippleAddress::createHumanAccountID(uInIssuerID)
|
||||
% STAmount::createHumanCurrency(uOutCurrencyID)
|
||||
% NewcoinAddress::createHumanAccountID(uOutIssuerID)
|
||||
% RippleAddress::createHumanAccountID(uOutIssuerID)
|
||||
% getJson());
|
||||
}
|
||||
|
||||
@@ -1656,13 +1656,13 @@ Json::Value PathState::getJson() const
|
||||
jvNode["flags"] = jvFlags;
|
||||
|
||||
if (pnNode.uFlags & STPathElement::typeAccount)
|
||||
jvNode["account"] = NewcoinAddress::createHumanAccountID(pnNode.uAccountID);
|
||||
jvNode["account"] = RippleAddress::createHumanAccountID(pnNode.uAccountID);
|
||||
|
||||
if (!!pnNode.uCurrencyID)
|
||||
jvNode["currency"] = STAmount::createHumanCurrency(pnNode.uCurrencyID);
|
||||
|
||||
if (!!pnNode.uIssuerID)
|
||||
jvNode["issuer"] = NewcoinAddress::createHumanAccountID(pnNode.uIssuerID);
|
||||
jvNode["issuer"] = RippleAddress::createHumanAccountID(pnNode.uIssuerID);
|
||||
|
||||
// if (pnNode.saRevRedeem)
|
||||
jvNode["rev_redeem"] = pnNode.saRevRedeem.getFullText();
|
||||
@@ -1757,7 +1757,7 @@ TER RippleCalc::calcNodeRev(const unsigned int uIndex, PathState::ref pspCur, co
|
||||
|
||||
cLog(lsINFO) << boost::str(boost::format("calcNodeRev> uIndex=%d uIssuerID=%s saTransferRate=%s")
|
||||
% uIndex
|
||||
% NewcoinAddress::createHumanAccountID(uCurIssuerID)
|
||||
% RippleAddress::createHumanAccountID(uCurIssuerID)
|
||||
% saTransferRate.getFullText());
|
||||
|
||||
terResult = bCurAccount
|
||||
|
||||
@@ -10,8 +10,8 @@ RippleState::RippleState(SerializedLedgerEntry::pointer ledgerEntry) :
|
||||
mLowLimit = mLedgerEntry->getFieldAmount(sfLowLimit);
|
||||
mHighLimit = mLedgerEntry->getFieldAmount(sfHighLimit);
|
||||
|
||||
mLowID = NewcoinAddress::createAccountID(mLowLimit.getIssuer());
|
||||
mHighID = NewcoinAddress::createAccountID(mHighLimit.getIssuer());
|
||||
mLowID = RippleAddress::createAccountID(mLowLimit.getIssuer());
|
||||
mHighID = RippleAddress::createAccountID(mHighLimit.getIssuer());
|
||||
|
||||
mLowQualityIn = mLedgerEntry->getFieldU32(sfLowQualityIn);
|
||||
mLowQualityOut = mLedgerEntry->getFieldU32(sfLowQualityOut);
|
||||
|
||||
@@ -18,8 +18,8 @@ public:
|
||||
private:
|
||||
SerializedLedgerEntry::pointer mLedgerEntry;
|
||||
|
||||
NewcoinAddress mLowID;
|
||||
NewcoinAddress mHighID;
|
||||
RippleAddress mLowID;
|
||||
RippleAddress mHighID;
|
||||
|
||||
STAmount mLowLimit;
|
||||
STAmount mHighLimit;
|
||||
@@ -39,8 +39,8 @@ public:
|
||||
|
||||
void setViewAccount(const uint160& accountID);
|
||||
|
||||
const NewcoinAddress getAccountID() const { return mViewLowest ? mLowID : mHighID; }
|
||||
const NewcoinAddress getAccountIDPeer() const { return mViewLowest ? mHighID : mLowID; }
|
||||
const RippleAddress getAccountID() const { return mViewLowest ? mLowID : mHighID; }
|
||||
const RippleAddress getAccountIDPeer() const { return mViewLowest ? mHighID : mLowID; }
|
||||
|
||||
STAmount getBalance() const { return mBalance; }
|
||||
|
||||
|
||||
@@ -119,19 +119,19 @@ bool SerializedLedgerEntry::hasTwoOwners()
|
||||
return mType == ltRIPPLE_STATE;
|
||||
}
|
||||
|
||||
NewcoinAddress SerializedLedgerEntry::getOwner()
|
||||
RippleAddress SerializedLedgerEntry::getOwner()
|
||||
{
|
||||
return getFieldAccount(sfAccount);
|
||||
}
|
||||
|
||||
NewcoinAddress SerializedLedgerEntry::getFirstOwner()
|
||||
RippleAddress SerializedLedgerEntry::getFirstOwner()
|
||||
{
|
||||
return NewcoinAddress::createAccountID(getFieldAmount(sfLowLimit).getIssuer());
|
||||
return RippleAddress::createAccountID(getFieldAmount(sfLowLimit).getIssuer());
|
||||
}
|
||||
|
||||
NewcoinAddress SerializedLedgerEntry::getSecondOwner()
|
||||
RippleAddress SerializedLedgerEntry::getSecondOwner()
|
||||
{
|
||||
return NewcoinAddress::createAccountID(getFieldAmount(sfHighLimit).getIssuer());
|
||||
return RippleAddress::createAccountID(getFieldAmount(sfHighLimit).getIssuer());
|
||||
}
|
||||
|
||||
std::vector<uint256> SerializedLedgerEntry::getOwners()
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "SerializedObject.h"
|
||||
#include "LedgerFormats.h"
|
||||
#include "NewcoinAddress.h"
|
||||
#include "RippleAddress.h"
|
||||
|
||||
class SerializedLedgerEntry : public STObject
|
||||
{
|
||||
@@ -39,9 +39,9 @@ public:
|
||||
bool isThreaded(); // is this ledger entry actually threaded
|
||||
bool hasOneOwner(); // This node has one other node that owns it (like nickname)
|
||||
bool hasTwoOwners(); // This node has two nodes that own it (like ripple balance)
|
||||
NewcoinAddress getOwner();
|
||||
NewcoinAddress getFirstOwner();
|
||||
NewcoinAddress getSecondOwner();
|
||||
RippleAddress getOwner();
|
||||
RippleAddress getFirstOwner();
|
||||
RippleAddress getSecondOwner();
|
||||
uint256 getThreadedTransaction();
|
||||
uint32 getThreadedLedger();
|
||||
bool thread(const uint256& txID, uint32 ledgerSeq, uint256& prevTxID, uint32& prevLedgerID);
|
||||
|
||||
@@ -573,7 +573,7 @@ uint256 STObject::getFieldH256(SField::ref field) const
|
||||
return cf->getValue();
|
||||
}
|
||||
|
||||
NewcoinAddress STObject::getFieldAccount(SField::ref field) const
|
||||
RippleAddress STObject::getFieldAccount(SField::ref field) const
|
||||
{
|
||||
const SerializedType* rf = peekAtPField(field);
|
||||
if (!rf)
|
||||
@@ -585,7 +585,7 @@ NewcoinAddress STObject::getFieldAccount(SField::ref field) const
|
||||
throw std::runtime_error("Field not found");
|
||||
}
|
||||
SerializedTypeID id = rf->getSType();
|
||||
if (id == STI_NOTPRESENT) return NewcoinAddress(); // optional field not present
|
||||
if (id == STI_NOTPRESENT) return RippleAddress(); // optional field not present
|
||||
const STAccount* cf = dynamic_cast<const STAccount *>(rf);
|
||||
if (!cf) throw std::runtime_error("Wrong field type");
|
||||
return cf->getValueNCA();
|
||||
@@ -1134,7 +1134,7 @@ std::auto_ptr<STObject> STObject::parseJson(const Json::Value& object, SField::r
|
||||
if (value.size() == 40) // 160-bit hex account value
|
||||
uAccount.SetHex(strValue);
|
||||
{
|
||||
NewcoinAddress a;
|
||||
RippleAddress a;
|
||||
if (!a.setAccountPublic(strValue))
|
||||
throw std::runtime_error("Account in path element invalid");
|
||||
uAccount = a.getAccountID();
|
||||
@@ -1158,7 +1158,7 @@ std::auto_ptr<STObject> STObject::parseJson(const Json::Value& object, SField::r
|
||||
uIssuer.SetHex(issuer.asString());
|
||||
else
|
||||
{
|
||||
NewcoinAddress a;
|
||||
RippleAddress a;
|
||||
if (!a.setAccountPublic(issuer.asString()))
|
||||
throw std::runtime_error("path element issuer invalid");
|
||||
uIssuer = a.getAccountID();
|
||||
@@ -1184,7 +1184,7 @@ std::auto_ptr<STObject> STObject::parseJson(const Json::Value& object, SField::r
|
||||
}
|
||||
else
|
||||
{ // ripple address
|
||||
NewcoinAddress a;
|
||||
RippleAddress a;
|
||||
if (!a.setAccountID(strValue))
|
||||
{
|
||||
cLog(lsINFO) << "Invalid acccount JSON: " << fieldName << ": " << strValue;
|
||||
|
||||
@@ -108,7 +108,7 @@ public:
|
||||
uint128 getFieldH128(SField::ref field) const;
|
||||
uint160 getFieldH160(SField::ref field) const;
|
||||
uint256 getFieldH256(SField::ref field) const;
|
||||
NewcoinAddress getFieldAccount(SField::ref field) const;
|
||||
RippleAddress getFieldAccount(SField::ref field) const;
|
||||
uint160 getFieldAccount160(SField::ref field) const;
|
||||
std::vector<unsigned char> getFieldVL(SField::ref field) const;
|
||||
std::vector<TaggedListItem> getFieldTL(SField::ref field) const;
|
||||
@@ -126,7 +126,7 @@ public:
|
||||
void setFieldVL(SField::ref field, const std::vector<unsigned char>&);
|
||||
void setFieldTL(SField::ref field, const std::vector<TaggedListItem>&);
|
||||
void setFieldAccount(SField::ref field, const uint160&);
|
||||
void setFieldAccount(SField::ref field, const NewcoinAddress& addr)
|
||||
void setFieldAccount(SField::ref field, const RippleAddress& addr)
|
||||
{ setFieldAccount(field, addr.getAccountID()); }
|
||||
void setFieldAmount(SField::ref field, const STAmount&);
|
||||
void setFieldPathSet(SField::ref field, const STPathSet&);
|
||||
|
||||
@@ -66,9 +66,9 @@ std::string SerializedTransaction::getText() const
|
||||
return STObject::getText();
|
||||
}
|
||||
|
||||
std::vector<NewcoinAddress> SerializedTransaction::getAffectedAccounts() const
|
||||
std::vector<RippleAddress> SerializedTransaction::getAffectedAccounts() const
|
||||
{
|
||||
std::vector<NewcoinAddress> accounts;
|
||||
std::vector<RippleAddress> accounts;
|
||||
|
||||
BOOST_FOREACH(const SerializedType& it, peekData())
|
||||
{
|
||||
@@ -76,8 +76,8 @@ std::vector<NewcoinAddress> SerializedTransaction::getAffectedAccounts() const
|
||||
if (sa != NULL)
|
||||
{
|
||||
bool found = false;
|
||||
NewcoinAddress na = sa->getValueNCA();
|
||||
for (std::vector<NewcoinAddress>::iterator it = accounts.begin(), end = accounts.end();
|
||||
RippleAddress na = sa->getValueNCA();
|
||||
for (std::vector<RippleAddress>::iterator it = accounts.begin(), end = accounts.end();
|
||||
it != end; ++it)
|
||||
{
|
||||
if (*it == na)
|
||||
@@ -115,7 +115,7 @@ std::vector<unsigned char> SerializedTransaction::getSignature() const
|
||||
}
|
||||
}
|
||||
|
||||
void SerializedTransaction::sign(const NewcoinAddress& naAccountPrivate)
|
||||
void SerializedTransaction::sign(const RippleAddress& naAccountPrivate)
|
||||
{
|
||||
std::vector<unsigned char> signature;
|
||||
naAccountPrivate.accountPrivateSign(getSigningHash(), signature);
|
||||
@@ -126,7 +126,7 @@ bool SerializedTransaction::checkSign() const
|
||||
{
|
||||
try
|
||||
{
|
||||
NewcoinAddress n;
|
||||
RippleAddress n;
|
||||
n.setAccountPublic(getFieldVL(sfSigningPubKey));
|
||||
return checkSign(n);
|
||||
}
|
||||
@@ -136,7 +136,7 @@ bool SerializedTransaction::checkSign() const
|
||||
}
|
||||
}
|
||||
|
||||
bool SerializedTransaction::checkSign(const NewcoinAddress& naAccountPublic) const
|
||||
bool SerializedTransaction::checkSign(const RippleAddress& naAccountPublic) const
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -148,12 +148,12 @@ bool SerializedTransaction::checkSign(const NewcoinAddress& naAccountPublic) con
|
||||
}
|
||||
}
|
||||
|
||||
void SerializedTransaction::setSigningPubKey(const NewcoinAddress& naSignPubKey)
|
||||
void SerializedTransaction::setSigningPubKey(const RippleAddress& naSignPubKey)
|
||||
{
|
||||
setFieldVL(sfSigningPubKey, naSignPubKey.getAccountPublic());
|
||||
}
|
||||
|
||||
void SerializedTransaction::setSourceAccount(const NewcoinAddress& naSource)
|
||||
void SerializedTransaction::setSourceAccount(const RippleAddress& naSource)
|
||||
{
|
||||
setFieldAccount(sfAccount, naSource);
|
||||
}
|
||||
@@ -199,11 +199,11 @@ BOOST_AUTO_TEST_SUITE(SerializedTransactionTS)
|
||||
|
||||
BOOST_AUTO_TEST_CASE( STrans_test )
|
||||
{
|
||||
NewcoinAddress seed;
|
||||
RippleAddress seed;
|
||||
seed.setSeedRandom();
|
||||
NewcoinAddress generator = NewcoinAddress::createGeneratorPublic(seed);
|
||||
NewcoinAddress publicAcct = NewcoinAddress::createAccountPublic(generator, 1);
|
||||
NewcoinAddress privateAcct = NewcoinAddress::createAccountPrivate(generator, seed, 1);
|
||||
RippleAddress generator = RippleAddress::createGeneratorPublic(seed);
|
||||
RippleAddress publicAcct = RippleAddress::createAccountPublic(generator, 1);
|
||||
RippleAddress privateAcct = RippleAddress::createAccountPrivate(generator, seed, 1);
|
||||
|
||||
SerializedTransaction j(ttCLAIM);
|
||||
j.setSourceAccount(publicAcct);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "uint256.h"
|
||||
#include "SerializedObject.h"
|
||||
#include "TransactionFormats.h"
|
||||
#include "NewcoinAddress.h"
|
||||
#include "RippleAddress.h"
|
||||
|
||||
#define TXN_SQL_NEW 'N'
|
||||
#define TXN_SQL_CONFLICT 'C'
|
||||
@@ -48,23 +48,23 @@ public:
|
||||
STAmount getTransactionFee() const { return getFieldAmount(sfFee); }
|
||||
void setTransactionFee(const STAmount& fee) { setFieldAmount(sfFee, fee); }
|
||||
|
||||
NewcoinAddress getSourceAccount() const { return getFieldAccount(sfAccount); }
|
||||
RippleAddress getSourceAccount() const { return getFieldAccount(sfAccount); }
|
||||
std::vector<unsigned char> getSigningPubKey() const { return getFieldVL(sfSigningPubKey); }
|
||||
void setSigningPubKey(const NewcoinAddress& naSignPubKey);
|
||||
void setSourceAccount(const NewcoinAddress& naSource);
|
||||
void setSigningPubKey(const RippleAddress& naSignPubKey);
|
||||
void setSourceAccount(const RippleAddress& naSource);
|
||||
std::string getTransactionType() const { return mFormat->t_name; }
|
||||
|
||||
uint32 getSequence() const { return getFieldU32(sfSequence); }
|
||||
void setSequence(uint32 seq) { return setFieldU32(sfSequence, seq); }
|
||||
|
||||
std::vector<NewcoinAddress> getAffectedAccounts() const;
|
||||
std::vector<RippleAddress> getAffectedAccounts() const;
|
||||
|
||||
uint256 getTransactionID() const;
|
||||
|
||||
virtual Json::Value getJson(int options) const;
|
||||
|
||||
void sign(const NewcoinAddress& naAccountPrivate);
|
||||
bool checkSign(const NewcoinAddress& naAccountPublic) const;
|
||||
void sign(const RippleAddress& naAccountPrivate);
|
||||
bool checkSign(const RippleAddress& naAccountPublic) const;
|
||||
bool checkSign() const;
|
||||
|
||||
// SQL Functions
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
#include "LedgerFormats.h"
|
||||
#include "FieldNames.h"
|
||||
#include "Log.h"
|
||||
#include "NewcoinAddress.h"
|
||||
#include "RippleAddress.h"
|
||||
#include "utils.h"
|
||||
#include "NewcoinAddress.h"
|
||||
#include "RippleAddress.h"
|
||||
#include "TransactionErr.h"
|
||||
|
||||
SETUP_LOG();
|
||||
@@ -23,7 +23,7 @@ void STPathSet::printDebug() {
|
||||
std::cout << i << ": ";
|
||||
for (int j = 0; j < value[i].mPath.size(); j++) {
|
||||
//STPathElement pe = value[i].mPath[j];
|
||||
NewcoinAddress nad;
|
||||
RippleAddress nad;
|
||||
nad.setAccountID(value[i].mPath[j].mAccountID);
|
||||
std::cout << " " << nad.humanAccountID();
|
||||
//std::cout << " " << pe.mAccountID.GetHex();
|
||||
@@ -36,7 +36,7 @@ void STPathSet::printDebug() {
|
||||
void STPath::printDebug() {
|
||||
std::cout << "STPath:" << std::endl;
|
||||
for(int i =0; i < mPath.size(); i++) {
|
||||
NewcoinAddress nad;
|
||||
RippleAddress nad;
|
||||
nad.setAccountID(mPath[i].mAccountID);
|
||||
std::cout << " " << i << ": " << nad.humanAccountID() << std::endl;
|
||||
}
|
||||
@@ -251,7 +251,7 @@ bool STVariableLength::isEquivalent(const SerializedType& t) const
|
||||
std::string STAccount::getText() const
|
||||
{
|
||||
uint160 u;
|
||||
NewcoinAddress a;
|
||||
RippleAddress a;
|
||||
|
||||
if (!getValueH160(u))
|
||||
return STVariableLength::getText();
|
||||
@@ -329,16 +329,16 @@ bool STAccount::getValueH160(uint160& v) const
|
||||
return true;
|
||||
}
|
||||
|
||||
NewcoinAddress STAccount::getValueNCA() const
|
||||
RippleAddress STAccount::getValueNCA() const
|
||||
{
|
||||
NewcoinAddress a;
|
||||
RippleAddress a;
|
||||
uint160 v;
|
||||
if (getValueH160(v))
|
||||
a.setAccountID(v);
|
||||
return a;
|
||||
}
|
||||
|
||||
void STAccount::setValueNCA(const NewcoinAddress& nca)
|
||||
void STAccount::setValueNCA(const RippleAddress& nca)
|
||||
{
|
||||
setValueH160(nca.getAccountID());
|
||||
}
|
||||
@@ -453,13 +453,13 @@ Json::Value STPath::getJson(int) const
|
||||
elem["type_hex"] = strHex(iType);
|
||||
|
||||
if (iType & STPathElement::typeAccount)
|
||||
elem["account"] = NewcoinAddress::createHumanAccountID(it.getAccountID());
|
||||
elem["account"] = RippleAddress::createHumanAccountID(it.getAccountID());
|
||||
|
||||
if (iType & STPathElement::typeCurrency)
|
||||
elem["currency"] = STAmount::createHumanCurrency(it.getCurrency());
|
||||
|
||||
if (iType & STPathElement::typeIssuer)
|
||||
elem["issuer"] = NewcoinAddress::createHumanAccountID(it.getIssuerID());
|
||||
elem["issuer"] = RippleAddress::createHumanAccountID(it.getIssuerID());
|
||||
|
||||
ret.append(elem);
|
||||
}
|
||||
@@ -490,7 +490,7 @@ std::string STPath::getText() const
|
||||
{
|
||||
case STPathElement::typeAccount:
|
||||
{
|
||||
ret += NewcoinAddress::createHumanAccountID(it.getNode());
|
||||
ret += RippleAddress::createHumanAccountID(it.getNode());
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -510,8 +510,8 @@ public:
|
||||
SerializedTypeID getSType() const { return STI_ACCOUNT; }
|
||||
std::string getText() const;
|
||||
|
||||
NewcoinAddress getValueNCA() const;
|
||||
void setValueNCA(const NewcoinAddress& nca);
|
||||
RippleAddress getValueNCA() const;
|
||||
void setValueNCA(const RippleAddress& nca);
|
||||
|
||||
void setValueH160(const uint160& v);
|
||||
bool getValueH160(uint160&) const;
|
||||
|
||||
@@ -27,7 +27,7 @@ const uint32 SerializedValidation::sFullFlag = 0x1;
|
||||
SerializedValidation::SerializedValidation(SerializerIterator& sit, bool checkSignature)
|
||||
: STObject(sValidationFormat, sit, sfValidation), mTrusted(false)
|
||||
{
|
||||
mNodeID = NewcoinAddress::createNodePublic(getFieldVL(sfSigningPubKey)).getNodeID();
|
||||
mNodeID = RippleAddress::createNodePublic(getFieldVL(sfSigningPubKey)).getNodeID();
|
||||
assert(mNodeID.isNonZero());
|
||||
if (checkSignature && !isValid())
|
||||
{
|
||||
@@ -37,14 +37,14 @@ SerializedValidation::SerializedValidation(SerializerIterator& sit, bool checkSi
|
||||
}
|
||||
|
||||
SerializedValidation::SerializedValidation(const uint256& ledgerHash, uint32 signTime,
|
||||
const NewcoinAddress& naSeed, bool isFull, uint256& signingHash)
|
||||
const RippleAddress& naSeed, bool isFull, uint256& signingHash)
|
||||
: STObject(sValidationFormat, sfValidation), mTrusted(false)
|
||||
{
|
||||
setFieldH256(sfLedgerHash, ledgerHash);
|
||||
setFieldU32(sfSigningTime, signTime);
|
||||
if (naSeed.isValid())
|
||||
{
|
||||
NewcoinAddress np = NewcoinAddress::createNodePublic(naSeed);
|
||||
RippleAddress np = RippleAddress::createNodePublic(naSeed);
|
||||
setFieldVL(sfSigningPubKey, np.getNodePublic());
|
||||
mNodeID = np.getNodeID();
|
||||
assert(mNodeID.isNonZero());
|
||||
@@ -54,10 +54,10 @@ SerializedValidation::SerializedValidation(const uint256& ledgerHash, uint32 sig
|
||||
|
||||
signingHash = getSigningHash();
|
||||
std::vector<unsigned char> signature;
|
||||
NewcoinAddress::createNodePrivate(naSeed).signNodePrivate(signingHash, signature);
|
||||
RippleAddress::createNodePrivate(naSeed).signNodePrivate(signingHash, signature);
|
||||
setFieldVL(sfSignature, signature);
|
||||
// XXX Check if this can fail.
|
||||
// if (!NewcoinAddress::createNodePrivate(naSeed).signNodePrivate(getSigningHash(), mSignature.peekValue()))
|
||||
// if (!RippleAddress::createNodePrivate(naSeed).signNodePrivate(getSigningHash(), mSignature.peekValue()))
|
||||
// throw std::runtime_error("Unable to sign validation");
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ bool SerializedValidation::isValid(const uint256& signingHash) const
|
||||
{
|
||||
try
|
||||
{
|
||||
NewcoinAddress naPublicKey = NewcoinAddress::createNodePublic(getFieldVL(sfSigningPubKey));
|
||||
RippleAddress naPublicKey = RippleAddress::createNodePublic(getFieldVL(sfSigningPubKey));
|
||||
return naPublicKey.isValid() && naPublicKey.verifyNodePublic(signingHash, getFieldVL(sfSignature));
|
||||
}
|
||||
catch (...)
|
||||
@@ -100,9 +100,9 @@ bool SerializedValidation::isValid(const uint256& signingHash) const
|
||||
}
|
||||
}
|
||||
|
||||
NewcoinAddress SerializedValidation::getSignerPublic() const
|
||||
RippleAddress SerializedValidation::getSignerPublic() const
|
||||
{
|
||||
NewcoinAddress a;
|
||||
RippleAddress a;
|
||||
a.setNodePublic(getFieldVL(sfSigningPubKey));
|
||||
return a;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#define __VALIDATION__
|
||||
|
||||
#include "SerializedObject.h"
|
||||
#include "NewcoinAddress.h"
|
||||
#include "RippleAddress.h"
|
||||
|
||||
class SerializedValidation : public STObject
|
||||
{
|
||||
@@ -21,13 +21,13 @@ public:
|
||||
|
||||
// These throw if the object is not valid
|
||||
SerializedValidation(SerializerIterator& sit, bool checkSignature = true);
|
||||
SerializedValidation(const uint256& ledgerHash, uint32 signTime, const NewcoinAddress& naSeed, bool isFull,
|
||||
SerializedValidation(const uint256& ledgerHash, uint32 signTime, const RippleAddress& naSeed, bool isFull,
|
||||
uint256& signingHash);
|
||||
|
||||
uint256 getLedgerHash() const;
|
||||
uint32 getSignTime() const;
|
||||
uint32 getFlags() const;
|
||||
NewcoinAddress getSignerPublic() const;
|
||||
RippleAddress getSignerPublic() const;
|
||||
uint160 getNodeID() const { return mNodeID; }
|
||||
bool isValid() const;
|
||||
bool isFull() const;
|
||||
|
||||
@@ -55,8 +55,8 @@ Transaction::pointer Transaction::sharedTransaction(const std::vector<unsigned c
|
||||
|
||||
Transaction::Transaction(
|
||||
TransactionType ttKind,
|
||||
const NewcoinAddress& naPublicKey,
|
||||
const NewcoinAddress& naSourceAccount,
|
||||
const RippleAddress& naPublicKey,
|
||||
const RippleAddress& naSourceAccount,
|
||||
uint32 uSeq,
|
||||
const STAmount& saFee,
|
||||
uint32 uSourceTag) :
|
||||
@@ -81,7 +81,7 @@ Transaction::Transaction(
|
||||
}
|
||||
}
|
||||
|
||||
bool Transaction::sign(const NewcoinAddress& naAccountPrivate)
|
||||
bool Transaction::sign(const RippleAddress& naAccountPrivate)
|
||||
{
|
||||
bool bResult = true;
|
||||
|
||||
@@ -109,12 +109,12 @@ bool Transaction::sign(const NewcoinAddress& naAccountPrivate)
|
||||
//
|
||||
|
||||
Transaction::pointer Transaction::setAccountSet(
|
||||
const NewcoinAddress& naPrivateKey,
|
||||
const RippleAddress& naPrivateKey,
|
||||
bool bEmailHash,
|
||||
const uint128& uEmailHash,
|
||||
bool bWalletLocator,
|
||||
const uint256& uWalletLocator,
|
||||
const NewcoinAddress& naMessagePublic,
|
||||
const RippleAddress& naMessagePublic,
|
||||
bool bDomain,
|
||||
const std::vector<unsigned char>& vucDomain,
|
||||
bool bTransferRate,
|
||||
@@ -151,8 +151,8 @@ Transaction::pointer Transaction::setAccountSet(
|
||||
}
|
||||
|
||||
Transaction::pointer Transaction::sharedAccountSet(
|
||||
const NewcoinAddress& naPublicKey, const NewcoinAddress& naPrivateKey,
|
||||
const NewcoinAddress& naSourceAccount,
|
||||
const RippleAddress& naPublicKey, const RippleAddress& naPrivateKey,
|
||||
const RippleAddress& naSourceAccount,
|
||||
uint32 uSeq,
|
||||
const STAmount& saFee,
|
||||
uint32 uSourceTag,
|
||||
@@ -160,7 +160,7 @@ Transaction::pointer Transaction::sharedAccountSet(
|
||||
const uint128& uEmailHash,
|
||||
bool bWalletLocator,
|
||||
const uint256& uWalletLocator,
|
||||
const NewcoinAddress& naMessagePublic,
|
||||
const RippleAddress& naMessagePublic,
|
||||
bool bDomain,
|
||||
const std::vector<unsigned char>& vucDomain,
|
||||
bool bTransferRate,
|
||||
@@ -181,7 +181,7 @@ Transaction::pointer Transaction::sharedAccountSet(
|
||||
//
|
||||
|
||||
Transaction::pointer Transaction::setClaim(
|
||||
const NewcoinAddress& naPrivateKey,
|
||||
const RippleAddress& naPrivateKey,
|
||||
const std::vector<unsigned char>& vucGenerator,
|
||||
const std::vector<unsigned char>& vucPubKey,
|
||||
const std::vector<unsigned char>& vucSignature)
|
||||
@@ -196,7 +196,7 @@ Transaction::pointer Transaction::setClaim(
|
||||
}
|
||||
|
||||
Transaction::pointer Transaction::sharedClaim(
|
||||
const NewcoinAddress& naPublicKey, const NewcoinAddress& naPrivateKey,
|
||||
const RippleAddress& naPublicKey, const RippleAddress& naPrivateKey,
|
||||
uint32 uSourceTag,
|
||||
const std::vector<unsigned char>& vucGenerator,
|
||||
const std::vector<unsigned char>& vucPubKey,
|
||||
@@ -216,8 +216,8 @@ Transaction::pointer Transaction::sharedClaim(
|
||||
//
|
||||
|
||||
Transaction::pointer Transaction::setCreate(
|
||||
const NewcoinAddress& naPrivateKey,
|
||||
const NewcoinAddress& naCreateAccountID,
|
||||
const RippleAddress& naPrivateKey,
|
||||
const RippleAddress& naCreateAccountID,
|
||||
const STAmount& saFund)
|
||||
{
|
||||
mTransaction->setFieldU32(sfFlags, tfCreateAccount);
|
||||
@@ -230,12 +230,12 @@ Transaction::pointer Transaction::setCreate(
|
||||
}
|
||||
|
||||
Transaction::pointer Transaction::sharedCreate(
|
||||
const NewcoinAddress& naPublicKey, const NewcoinAddress& naPrivateKey,
|
||||
const NewcoinAddress& naSourceAccount,
|
||||
const RippleAddress& naPublicKey, const RippleAddress& naPrivateKey,
|
||||
const RippleAddress& naSourceAccount,
|
||||
uint32 uSeq,
|
||||
const STAmount& saFee,
|
||||
uint32 uSourceTag,
|
||||
const NewcoinAddress& naCreateAccountID,
|
||||
const RippleAddress& naCreateAccountID,
|
||||
const STAmount& saFund)
|
||||
{
|
||||
pointer tResult = boost::make_shared<Transaction>(ttPAYMENT, naPublicKey, naSourceAccount, uSeq, saFee, uSourceTag);
|
||||
@@ -248,7 +248,7 @@ Transaction::pointer Transaction::sharedCreate(
|
||||
//
|
||||
|
||||
Transaction::pointer Transaction::setCreditSet(
|
||||
const NewcoinAddress& naPrivateKey,
|
||||
const RippleAddress& naPrivateKey,
|
||||
const STAmount& saLimitAmount,
|
||||
bool bQualityIn,
|
||||
uint32 uQualityIn,
|
||||
@@ -269,8 +269,8 @@ Transaction::pointer Transaction::setCreditSet(
|
||||
}
|
||||
|
||||
Transaction::pointer Transaction::sharedCreditSet(
|
||||
const NewcoinAddress& naPublicKey, const NewcoinAddress& naPrivateKey,
|
||||
const NewcoinAddress& naSourceAccount,
|
||||
const RippleAddress& naPublicKey, const RippleAddress& naPrivateKey,
|
||||
const RippleAddress& naSourceAccount,
|
||||
uint32 uSeq,
|
||||
const STAmount& saFee,
|
||||
uint32 uSourceTag,
|
||||
@@ -293,7 +293,7 @@ Transaction::pointer Transaction::sharedCreditSet(
|
||||
//
|
||||
|
||||
Transaction::pointer Transaction::setNicknameSet(
|
||||
const NewcoinAddress& naPrivateKey,
|
||||
const RippleAddress& naPrivateKey,
|
||||
const uint256& uNickname,
|
||||
bool bSetOffer,
|
||||
const STAmount& saMinimumOffer)
|
||||
@@ -312,8 +312,8 @@ Transaction::pointer Transaction::setNicknameSet(
|
||||
// --> bSetOffer: true, change offer
|
||||
// --> saMinimumOffer: 0 to remove.
|
||||
Transaction::pointer Transaction::sharedNicknameSet(
|
||||
const NewcoinAddress& naPublicKey, const NewcoinAddress& naPrivateKey,
|
||||
const NewcoinAddress& naSourceAccount,
|
||||
const RippleAddress& naPublicKey, const RippleAddress& naPrivateKey,
|
||||
const RippleAddress& naSourceAccount,
|
||||
uint32 uSeq,
|
||||
const STAmount& saFee,
|
||||
uint32 uSourceTag,
|
||||
@@ -331,7 +331,7 @@ Transaction::pointer Transaction::sharedNicknameSet(
|
||||
//
|
||||
|
||||
Transaction::pointer Transaction::setOfferCreate(
|
||||
const NewcoinAddress& naPrivateKey,
|
||||
const RippleAddress& naPrivateKey,
|
||||
bool bPassive,
|
||||
const STAmount& saTakerPays,
|
||||
const STAmount& saTakerGets,
|
||||
@@ -352,8 +352,8 @@ Transaction::pointer Transaction::setOfferCreate(
|
||||
}
|
||||
|
||||
Transaction::pointer Transaction::sharedOfferCreate(
|
||||
const NewcoinAddress& naPublicKey, const NewcoinAddress& naPrivateKey,
|
||||
const NewcoinAddress& naSourceAccount,
|
||||
const RippleAddress& naPublicKey, const RippleAddress& naPrivateKey,
|
||||
const RippleAddress& naSourceAccount,
|
||||
uint32 uSeq,
|
||||
const STAmount& saFee,
|
||||
uint32 uSourceTag,
|
||||
@@ -372,7 +372,7 @@ Transaction::pointer Transaction::sharedOfferCreate(
|
||||
//
|
||||
|
||||
Transaction::pointer Transaction::setOfferCancel(
|
||||
const NewcoinAddress& naPrivateKey,
|
||||
const RippleAddress& naPrivateKey,
|
||||
uint32 uSequence)
|
||||
{
|
||||
mTransaction->setFieldU32(sfOfferSequence, uSequence);
|
||||
@@ -383,8 +383,8 @@ Transaction::pointer Transaction::setOfferCancel(
|
||||
}
|
||||
|
||||
Transaction::pointer Transaction::sharedOfferCancel(
|
||||
const NewcoinAddress& naPublicKey, const NewcoinAddress& naPrivateKey,
|
||||
const NewcoinAddress& naSourceAccount,
|
||||
const RippleAddress& naPublicKey, const RippleAddress& naPrivateKey,
|
||||
const RippleAddress& naSourceAccount,
|
||||
uint32 uSeq,
|
||||
const STAmount& saFee,
|
||||
uint32 uSourceTag,
|
||||
@@ -400,8 +400,8 @@ Transaction::pointer Transaction::sharedOfferCancel(
|
||||
//
|
||||
|
||||
Transaction::pointer Transaction::setPasswordFund(
|
||||
const NewcoinAddress& naPrivateKey,
|
||||
const NewcoinAddress& naDstAccountID)
|
||||
const RippleAddress& naPrivateKey,
|
||||
const RippleAddress& naDstAccountID)
|
||||
{
|
||||
mTransaction->setFieldAccount(sfDestination, naDstAccountID);
|
||||
|
||||
@@ -411,12 +411,12 @@ Transaction::pointer Transaction::setPasswordFund(
|
||||
}
|
||||
|
||||
Transaction::pointer Transaction::sharedPasswordFund(
|
||||
const NewcoinAddress& naPublicKey, const NewcoinAddress& naPrivateKey,
|
||||
const NewcoinAddress& naSourceAccount,
|
||||
const RippleAddress& naPublicKey, const RippleAddress& naPrivateKey,
|
||||
const RippleAddress& naSourceAccount,
|
||||
uint32 uSeq,
|
||||
const STAmount& saFee,
|
||||
uint32 uSourceTag,
|
||||
const NewcoinAddress& naDstAccountID)
|
||||
const RippleAddress& naDstAccountID)
|
||||
{
|
||||
pointer tResult = boost::make_shared<Transaction>(ttPASSWORD_FUND, naPublicKey, naSourceAccount, uSeq, saFee, uSourceTag);
|
||||
|
||||
@@ -428,8 +428,8 @@ Transaction::pointer Transaction::sharedPasswordFund(
|
||||
//
|
||||
|
||||
Transaction::pointer Transaction::setPasswordSet(
|
||||
const NewcoinAddress& naPrivateKey,
|
||||
const NewcoinAddress& naAuthKeyID,
|
||||
const RippleAddress& naPrivateKey,
|
||||
const RippleAddress& naAuthKeyID,
|
||||
const std::vector<unsigned char>& vucGenerator,
|
||||
const std::vector<unsigned char>& vucPubKey,
|
||||
const std::vector<unsigned char>& vucSignature)
|
||||
@@ -445,9 +445,9 @@ Transaction::pointer Transaction::setPasswordSet(
|
||||
}
|
||||
|
||||
Transaction::pointer Transaction::sharedPasswordSet(
|
||||
const NewcoinAddress& naPublicKey, const NewcoinAddress& naPrivateKey,
|
||||
const RippleAddress& naPublicKey, const RippleAddress& naPrivateKey,
|
||||
uint32 uSourceTag,
|
||||
const NewcoinAddress& naAuthKeyID,
|
||||
const RippleAddress& naAuthKeyID,
|
||||
const std::vector<unsigned char>& vucGenerator,
|
||||
const std::vector<unsigned char>& vucPubKey,
|
||||
const std::vector<unsigned char>& vucSignature)
|
||||
@@ -466,8 +466,8 @@ Transaction::pointer Transaction::sharedPasswordSet(
|
||||
//
|
||||
|
||||
Transaction::pointer Transaction::setPayment(
|
||||
const NewcoinAddress& naPrivateKey,
|
||||
const NewcoinAddress& naDstAccountID,
|
||||
const RippleAddress& naPrivateKey,
|
||||
const RippleAddress& naDstAccountID,
|
||||
const STAmount& saAmount,
|
||||
const STAmount& saSendMax,
|
||||
const STPathSet& spsPaths,
|
||||
@@ -493,12 +493,12 @@ Transaction::pointer Transaction::setPayment(
|
||||
}
|
||||
|
||||
Transaction::pointer Transaction::sharedPayment(
|
||||
const NewcoinAddress& naPublicKey, const NewcoinAddress& naPrivateKey,
|
||||
const NewcoinAddress& naSourceAccount,
|
||||
const RippleAddress& naPublicKey, const RippleAddress& naPrivateKey,
|
||||
const RippleAddress& naSourceAccount,
|
||||
uint32 uSeq,
|
||||
const STAmount& saFee,
|
||||
uint32 uSourceTag,
|
||||
const NewcoinAddress& naDstAccountID,
|
||||
const RippleAddress& naDstAccountID,
|
||||
const STAmount& saAmount,
|
||||
const STAmount& saSendMax,
|
||||
const STPathSet& spsPaths,
|
||||
@@ -515,10 +515,10 @@ Transaction::pointer Transaction::sharedPayment(
|
||||
//
|
||||
|
||||
Transaction::pointer Transaction::setWalletAdd(
|
||||
const NewcoinAddress& naPrivateKey,
|
||||
const RippleAddress& naPrivateKey,
|
||||
const STAmount& saAmount,
|
||||
const NewcoinAddress& naAuthKeyID,
|
||||
const NewcoinAddress& naNewPubKey,
|
||||
const RippleAddress& naAuthKeyID,
|
||||
const RippleAddress& naNewPubKey,
|
||||
const std::vector<unsigned char>& vucSignature)
|
||||
{
|
||||
mTransaction->setFieldAmount(sfAmount, saAmount);
|
||||
@@ -532,14 +532,14 @@ Transaction::pointer Transaction::setWalletAdd(
|
||||
}
|
||||
|
||||
Transaction::pointer Transaction::sharedWalletAdd(
|
||||
const NewcoinAddress& naPublicKey, const NewcoinAddress& naPrivateKey,
|
||||
const NewcoinAddress& naSourceAccount,
|
||||
const RippleAddress& naPublicKey, const RippleAddress& naPrivateKey,
|
||||
const RippleAddress& naSourceAccount,
|
||||
uint32 uSeq,
|
||||
const STAmount& saFee,
|
||||
uint32 uSourceTag,
|
||||
const STAmount& saAmount,
|
||||
const NewcoinAddress& naAuthKeyID,
|
||||
const NewcoinAddress& naNewPubKey,
|
||||
const RippleAddress& naAuthKeyID,
|
||||
const RippleAddress& naNewPubKey,
|
||||
const std::vector<unsigned char>& vucSignature)
|
||||
{
|
||||
pointer tResult = boost::make_shared<Transaction>(ttWALLET_ADD, naPublicKey, naSourceAccount, uSeq, saFee, uSourceTag);
|
||||
@@ -690,7 +690,7 @@ Transaction::pointer Transaction::load(const uint256& id)
|
||||
return transactionFromSQL(sql);
|
||||
}
|
||||
|
||||
Transaction::pointer Transaction::findFrom(const NewcoinAddress& fromID, uint32 seq)
|
||||
Transaction::pointer Transaction::findFrom(const RippleAddress& fromID, uint32 seq)
|
||||
{
|
||||
std::string sql = "SELECT LedgerSeq,Status,RawTxn FROM Transactions WHERE FromID='";
|
||||
sql.append(fromID.humanAccountID());
|
||||
|
||||
@@ -45,9 +45,9 @@ public:
|
||||
|
||||
private:
|
||||
uint256 mTransactionID;
|
||||
NewcoinAddress mAccountFrom;
|
||||
NewcoinAddress mFromPubKey; // Sign transaction with this. mSignPubKey
|
||||
NewcoinAddress mSourcePrivate; // Sign transaction with this.
|
||||
RippleAddress mAccountFrom;
|
||||
RippleAddress mFromPubKey; // Sign transaction with this. mSignPubKey
|
||||
RippleAddress mSourcePrivate; // Sign transaction with this.
|
||||
|
||||
uint32 mInLedger;
|
||||
TransStatus mStatus;
|
||||
@@ -56,12 +56,12 @@ private:
|
||||
SerializedTransaction::pointer mTransaction;
|
||||
|
||||
Transaction::pointer setAccountSet(
|
||||
const NewcoinAddress& naPrivateKey,
|
||||
const RippleAddress& naPrivateKey,
|
||||
bool bEmailHash,
|
||||
const uint128& uEmailHash,
|
||||
bool bWalletLocator,
|
||||
const uint256& uWalletLocator,
|
||||
const NewcoinAddress& naMessagePublic,
|
||||
const RippleAddress& naMessagePublic,
|
||||
bool bDomain,
|
||||
const std::vector<unsigned char>& vucDomain,
|
||||
bool bTransferRate,
|
||||
@@ -71,18 +71,18 @@ private:
|
||||
const uint32 uPublishSize);
|
||||
|
||||
Transaction::pointer setClaim(
|
||||
const NewcoinAddress& naPrivateKey,
|
||||
const RippleAddress& naPrivateKey,
|
||||
const std::vector<unsigned char>& vucGenerator,
|
||||
const std::vector<unsigned char>& vucPubKey,
|
||||
const std::vector<unsigned char>& vucSignature);
|
||||
|
||||
Transaction::pointer setCreate(
|
||||
const NewcoinAddress& naPrivateKey,
|
||||
const NewcoinAddress& naCreateAccountID,
|
||||
const RippleAddress& naPrivateKey,
|
||||
const RippleAddress& naCreateAccountID,
|
||||
const STAmount& saFund);
|
||||
|
||||
Transaction::pointer setCreditSet(
|
||||
const NewcoinAddress& naPrivateKey,
|
||||
const RippleAddress& naPrivateKey,
|
||||
const STAmount& saLimitAmount,
|
||||
bool bQualityIn,
|
||||
uint32 uQualityIn,
|
||||
@@ -90,36 +90,36 @@ private:
|
||||
uint32 uQualityOut);
|
||||
|
||||
Transaction::pointer setNicknameSet(
|
||||
const NewcoinAddress& naPrivateKey,
|
||||
const RippleAddress& naPrivateKey,
|
||||
const uint256& uNickname,
|
||||
bool bSetOffer,
|
||||
const STAmount& saMinimumOffer);
|
||||
|
||||
Transaction::pointer setOfferCreate(
|
||||
const NewcoinAddress& naPrivateKey,
|
||||
const RippleAddress& naPrivateKey,
|
||||
bool bPassive,
|
||||
const STAmount& saTakerPays,
|
||||
const STAmount& saTakerGets,
|
||||
uint32 uExpiration);
|
||||
|
||||
Transaction::pointer setOfferCancel(
|
||||
const NewcoinAddress& naPrivateKey,
|
||||
const RippleAddress& naPrivateKey,
|
||||
uint32 uSequence);
|
||||
|
||||
Transaction::pointer setPasswordFund(
|
||||
const NewcoinAddress& naPrivateKey,
|
||||
const NewcoinAddress& naDstAccountID);
|
||||
const RippleAddress& naPrivateKey,
|
||||
const RippleAddress& naDstAccountID);
|
||||
|
||||
Transaction::pointer setPasswordSet(
|
||||
const NewcoinAddress& naPrivateKey,
|
||||
const NewcoinAddress& naAuthKeyID,
|
||||
const RippleAddress& naPrivateKey,
|
||||
const RippleAddress& naAuthKeyID,
|
||||
const std::vector<unsigned char>& vucGenerator,
|
||||
const std::vector<unsigned char>& vucPubKey,
|
||||
const std::vector<unsigned char>& vucSignature);
|
||||
|
||||
Transaction::pointer setPayment(
|
||||
const NewcoinAddress& naPrivateKey,
|
||||
const NewcoinAddress& naDstAccountID,
|
||||
const RippleAddress& naPrivateKey,
|
||||
const RippleAddress& naDstAccountID,
|
||||
const STAmount& saAmount,
|
||||
const STAmount& saSendMax,
|
||||
const STPathSet& spsPaths,
|
||||
@@ -127,10 +127,10 @@ private:
|
||||
const bool bLimit);
|
||||
|
||||
Transaction::pointer setWalletAdd(
|
||||
const NewcoinAddress& naPrivateKey,
|
||||
const RippleAddress& naPrivateKey,
|
||||
const STAmount& saAmount,
|
||||
const NewcoinAddress& naAuthKeyID,
|
||||
const NewcoinAddress& naNewPubKey,
|
||||
const RippleAddress& naAuthKeyID,
|
||||
const RippleAddress& naNewPubKey,
|
||||
const std::vector<unsigned char>& vucSignature);
|
||||
|
||||
public:
|
||||
@@ -141,16 +141,16 @@ public:
|
||||
|
||||
Transaction(
|
||||
TransactionType ttKind,
|
||||
const NewcoinAddress& naPublicKey, // To prove transaction is consistent and authorized.
|
||||
const NewcoinAddress& naSourceAccount, // To identify the paying account.
|
||||
const RippleAddress& naPublicKey, // To prove transaction is consistent and authorized.
|
||||
const RippleAddress& naSourceAccount, // To identify the paying account.
|
||||
uint32 uSeq, // To order transactions.
|
||||
const STAmount& saFee, // Transaction fee.
|
||||
uint32 uSourceTag); // User call back value.
|
||||
|
||||
// Change account settings.
|
||||
static Transaction::pointer sharedAccountSet(
|
||||
const NewcoinAddress& naPublicKey, const NewcoinAddress& naPrivateKey,
|
||||
const NewcoinAddress& naSourceAccount,
|
||||
const RippleAddress& naPublicKey, const RippleAddress& naPrivateKey,
|
||||
const RippleAddress& naSourceAccount,
|
||||
uint32 uSeq,
|
||||
const STAmount& saFee,
|
||||
uint32 uSourceTag,
|
||||
@@ -158,7 +158,7 @@ public:
|
||||
const uint128& uEmailHash,
|
||||
bool bWalletLocator,
|
||||
const uint256& uWalletLocator,
|
||||
const NewcoinAddress& naMessagePublic,
|
||||
const RippleAddress& naMessagePublic,
|
||||
bool bDomain,
|
||||
const std::vector<unsigned char>& vucDomain,
|
||||
bool bTransferRate,
|
||||
@@ -169,7 +169,7 @@ public:
|
||||
|
||||
// Claim a wallet.
|
||||
static Transaction::pointer sharedClaim(
|
||||
const NewcoinAddress& naPublicKey, const NewcoinAddress& naPrivateKey,
|
||||
const RippleAddress& naPublicKey, const RippleAddress& naPrivateKey,
|
||||
uint32 uSourceTag,
|
||||
const std::vector<unsigned char>& vucGenerator,
|
||||
const std::vector<unsigned char>& vucPubKey,
|
||||
@@ -177,18 +177,18 @@ public:
|
||||
|
||||
// Create an account.
|
||||
static Transaction::pointer sharedCreate(
|
||||
const NewcoinAddress& naPublicKey, const NewcoinAddress& naPrivateKey,
|
||||
const NewcoinAddress& naSourceAccount,
|
||||
const RippleAddress& naPublicKey, const RippleAddress& naPrivateKey,
|
||||
const RippleAddress& naSourceAccount,
|
||||
uint32 uSeq,
|
||||
const STAmount& saFee,
|
||||
uint32 uSourceTag,
|
||||
const NewcoinAddress& naCreateAccountID, // Account to create.
|
||||
const RippleAddress& naCreateAccountID, // Account to create.
|
||||
const STAmount& saFund); // Initial funds in XNC.
|
||||
|
||||
// Set credit limit and borrow fees.
|
||||
static Transaction::pointer sharedCreditSet(
|
||||
const NewcoinAddress& naPublicKey, const NewcoinAddress& naPrivateKey,
|
||||
const NewcoinAddress& naSourceAccount,
|
||||
const RippleAddress& naPublicKey, const RippleAddress& naPrivateKey,
|
||||
const RippleAddress& naSourceAccount,
|
||||
uint32 uSeq,
|
||||
const STAmount& saFee,
|
||||
uint32 uSourceTag,
|
||||
@@ -200,8 +200,8 @@ public:
|
||||
|
||||
// Set Nickname
|
||||
static Transaction::pointer sharedNicknameSet(
|
||||
const NewcoinAddress& naPublicKey, const NewcoinAddress& naPrivateKey,
|
||||
const NewcoinAddress& naSourceAccount,
|
||||
const RippleAddress& naPublicKey, const RippleAddress& naPrivateKey,
|
||||
const RippleAddress& naSourceAccount,
|
||||
uint32 uSeq,
|
||||
const STAmount& saFee,
|
||||
uint32 uSourceTag,
|
||||
@@ -211,30 +211,30 @@ public:
|
||||
|
||||
// Pre-fund password change.
|
||||
static Transaction::pointer sharedPasswordFund(
|
||||
const NewcoinAddress& naPublicKey, const NewcoinAddress& naPrivateKey,
|
||||
const NewcoinAddress& naSourceAccount,
|
||||
const RippleAddress& naPublicKey, const RippleAddress& naPrivateKey,
|
||||
const RippleAddress& naSourceAccount,
|
||||
uint32 uSeq,
|
||||
const STAmount& saFee,
|
||||
uint32 uSourceTag,
|
||||
const NewcoinAddress& naDstAccountID);
|
||||
const RippleAddress& naDstAccountID);
|
||||
|
||||
// Change a password.
|
||||
static Transaction::pointer sharedPasswordSet(
|
||||
const NewcoinAddress& naPublicKey, const NewcoinAddress& naPrivateKey,
|
||||
const RippleAddress& naPublicKey, const RippleAddress& naPrivateKey,
|
||||
uint32 uSourceTag,
|
||||
const NewcoinAddress& naAuthKeyID, // ID of regular public to auth.
|
||||
const RippleAddress& naAuthKeyID, // ID of regular public to auth.
|
||||
const std::vector<unsigned char>& vucGenerator,
|
||||
const std::vector<unsigned char>& vucPubKey,
|
||||
const std::vector<unsigned char>& vucSignature);
|
||||
|
||||
// Make a payment.
|
||||
static Transaction::pointer sharedPayment(
|
||||
const NewcoinAddress& naPublicKey, const NewcoinAddress& naPrivateKey,
|
||||
const NewcoinAddress& naSourceAccount,
|
||||
const RippleAddress& naPublicKey, const RippleAddress& naPrivateKey,
|
||||
const RippleAddress& naSourceAccount,
|
||||
uint32 uSeq,
|
||||
const STAmount& saFee,
|
||||
uint32 uSourceTag,
|
||||
const NewcoinAddress& naDstAccountID,
|
||||
const RippleAddress& naDstAccountID,
|
||||
const STAmount& saAmount,
|
||||
const STAmount& saSendMax,
|
||||
const STPathSet& spsPaths,
|
||||
@@ -243,8 +243,8 @@ public:
|
||||
|
||||
// Place an offer.
|
||||
static Transaction::pointer sharedOfferCreate(
|
||||
const NewcoinAddress& naPublicKey, const NewcoinAddress& naPrivateKey,
|
||||
const NewcoinAddress& naSourceAccount,
|
||||
const RippleAddress& naPublicKey, const RippleAddress& naPrivateKey,
|
||||
const RippleAddress& naSourceAccount,
|
||||
uint32 uSeq,
|
||||
const STAmount& saFee,
|
||||
uint32 uSourceTag,
|
||||
@@ -255,8 +255,8 @@ public:
|
||||
|
||||
// Cancel an offer
|
||||
static Transaction::pointer sharedOfferCancel(
|
||||
const NewcoinAddress& naPublicKey, const NewcoinAddress& naPrivateKey,
|
||||
const NewcoinAddress& naSourceAccount,
|
||||
const RippleAddress& naPublicKey, const RippleAddress& naPrivateKey,
|
||||
const RippleAddress& naSourceAccount,
|
||||
uint32 uSeq,
|
||||
const STAmount& saFee,
|
||||
uint32 uSourceTag,
|
||||
@@ -264,24 +264,24 @@ public:
|
||||
|
||||
// Add an account to a wallet.
|
||||
static Transaction::pointer sharedWalletAdd(
|
||||
const NewcoinAddress& naPublicKey, const NewcoinAddress& naPrivateKey,
|
||||
const NewcoinAddress& naSourceAccount,
|
||||
const RippleAddress& naPublicKey, const RippleAddress& naPrivateKey,
|
||||
const RippleAddress& naSourceAccount,
|
||||
uint32 uSeq,
|
||||
const STAmount& saFee,
|
||||
uint32 uSourceTag,
|
||||
const STAmount& saAmount, // Initial funds in XNC.
|
||||
const NewcoinAddress& naAuthKeyID, // ID of regular public to auth.
|
||||
const NewcoinAddress& naNewPubKey, // Public key of new account
|
||||
const RippleAddress& naAuthKeyID, // ID of regular public to auth.
|
||||
const RippleAddress& naNewPubKey, // Public key of new account
|
||||
const std::vector<unsigned char>& vucSignature); // Proof know new account's private key.
|
||||
|
||||
bool sign(const NewcoinAddress& naAccountPrivate);
|
||||
bool sign(const RippleAddress& naAccountPrivate);
|
||||
bool checkSign() const;
|
||||
void updateID() { mTransactionID=mTransaction->getTransactionID(); }
|
||||
|
||||
SerializedTransaction::pointer getSTransaction() { return mTransaction; }
|
||||
|
||||
const uint256& getID() const { return mTransactionID; }
|
||||
const NewcoinAddress& getFromAccount() const { return mAccountFrom; }
|
||||
const RippleAddress& getFromAccount() const { return mAccountFrom; }
|
||||
STAmount getAmount() const { return mTransaction->getFieldU64(sfAmount); }
|
||||
STAmount getFee() const { return mTransaction->getTransactionFee(); }
|
||||
uint32 getFromAccountSeq() const { return mTransaction->getSequence(); }
|
||||
@@ -301,7 +301,7 @@ public:
|
||||
static void saveTransaction(const Transaction::pointer&);
|
||||
bool save();
|
||||
static Transaction::pointer load(const uint256& id);
|
||||
static Transaction::pointer findFrom(const NewcoinAddress& fromID, uint32 seq);
|
||||
static Transaction::pointer findFrom(const RippleAddress& fromID, uint32 seq);
|
||||
|
||||
// conversion function
|
||||
static bool convertToTransactions(uint32 ourLedgerSeq, uint32 otherLedgerSeq,
|
||||
|
||||
@@ -32,7 +32,7 @@ TER TransactionEngine::setAuthorized(const SerializedTransaction& txn, bool bMus
|
||||
std::vector<unsigned char> vucCipher = txn.getFieldVL(sfGenerator);
|
||||
std::vector<unsigned char> vucPubKey = txn.getFieldVL(sfPublicKey);
|
||||
std::vector<unsigned char> vucSignature = txn.getFieldVL(sfSignature);
|
||||
NewcoinAddress naAccountPublic = NewcoinAddress::createAccountPublic(vucPubKey);
|
||||
RippleAddress naAccountPublic = RippleAddress::createAccountPublic(vucPubKey);
|
||||
|
||||
if (!naAccountPublic.accountPublicVerify(Serializer::getSHA512Half(vucCipher), vucSignature))
|
||||
{
|
||||
@@ -641,7 +641,7 @@ TER TransactionEngine::doWalletAdd(const SerializedTransaction& txn)
|
||||
const std::vector<unsigned char> vucPubKey = txn.getFieldVL(sfPublicKey);
|
||||
const std::vector<unsigned char> vucSignature = txn.getFieldVL(sfSignature);
|
||||
const uint160 uAuthKeyID = txn.getFieldAccount160(sfAuthorizedKey);
|
||||
const NewcoinAddress naMasterPubKey = NewcoinAddress::createAccountPublic(vucPubKey);
|
||||
const RippleAddress naMasterPubKey = RippleAddress::createAccountPublic(vucPubKey);
|
||||
const uint160 uDstAccountID = naMasterPubKey.getAccountID();
|
||||
|
||||
if (!naMasterPubKey.accountPublicVerify(Serializer::getSHA512Half(uAuthKeyID.begin(), uAuthKeyID.size()), vucSignature))
|
||||
@@ -1018,7 +1018,7 @@ Log(lsINFO) << boost::str(boost::format("doOfferCreate: saTakerPays=%s saTakerGe
|
||||
|
||||
if (!sleTakerPays)
|
||||
{
|
||||
Log(lsWARNING) << "doOfferCreate: delay: can't receive IOUs from non-existant issuer: " << NewcoinAddress::createHumanAccountID(uPaysIssuerID);
|
||||
Log(lsWARNING) << "doOfferCreate: delay: can't receive IOUs from non-existant issuer: " << RippleAddress::createHumanAccountID(uPaysIssuerID);
|
||||
|
||||
terResult = terNO_ACCOUNT;
|
||||
}
|
||||
@@ -1066,11 +1066,11 @@ Log(lsINFO) << boost::str(boost::format("doOfferCreate: saTakerPays=%s saTakerGe
|
||||
|
||||
Log(lsWARNING) << "doOfferCreate: takeOffers: saTakerPays=" << saTakerPays.getFullText();
|
||||
Log(lsWARNING) << "doOfferCreate: takeOffers: saTakerGets=" << saTakerGets.getFullText();
|
||||
Log(lsWARNING) << "doOfferCreate: takeOffers: mTxnAccountID=" << NewcoinAddress::createHumanAccountID(mTxnAccountID);
|
||||
Log(lsWARNING) << "doOfferCreate: takeOffers: mTxnAccountID=" << RippleAddress::createHumanAccountID(mTxnAccountID);
|
||||
Log(lsWARNING) << "doOfferCreate: takeOffers: FUNDS=" << mNodes.accountFunds(mTxnAccountID, saTakerGets).getFullText();
|
||||
|
||||
// Log(lsWARNING) << "doOfferCreate: takeOffers: uPaysIssuerID=" << NewcoinAddress::createHumanAccountID(uPaysIssuerID);
|
||||
// Log(lsWARNING) << "doOfferCreate: takeOffers: uGetsIssuerID=" << NewcoinAddress::createHumanAccountID(uGetsIssuerID);
|
||||
// Log(lsWARNING) << "doOfferCreate: takeOffers: uPaysIssuerID=" << RippleAddress::createHumanAccountID(uPaysIssuerID);
|
||||
// Log(lsWARNING) << "doOfferCreate: takeOffers: uGetsIssuerID=" << RippleAddress::createHumanAccountID(uGetsIssuerID);
|
||||
|
||||
if (tesSUCCESS == terResult
|
||||
&& saTakerPays // Still wanting something.
|
||||
@@ -1092,9 +1092,9 @@ Log(lsINFO) << boost::str(boost::format("doOfferCreate: saTakerPays=%s saTakerGe
|
||||
Log(lsINFO) << boost::str(boost::format("doOfferCreate: adding to book: %s : %s/%s -> %s/%s")
|
||||
% uBookBase.ToString()
|
||||
% saTakerPays.getHumanCurrency()
|
||||
% NewcoinAddress::createHumanAccountID(saTakerPays.getIssuer())
|
||||
% RippleAddress::createHumanAccountID(saTakerPays.getIssuer())
|
||||
% saTakerGets.getHumanCurrency()
|
||||
% NewcoinAddress::createHumanAccountID(saTakerGets.getIssuer()));
|
||||
% RippleAddress::createHumanAccountID(saTakerGets.getIssuer()));
|
||||
|
||||
uDirectory = Ledger::getQualityIndex(uBookBase, uRate); // Use original rate.
|
||||
|
||||
@@ -1104,9 +1104,9 @@ Log(lsINFO) << boost::str(boost::format("doOfferCreate: saTakerPays=%s saTakerGe
|
||||
|
||||
if (tesSUCCESS == terResult)
|
||||
{
|
||||
Log(lsWARNING) << "doOfferCreate: sfAccount=" << NewcoinAddress::createHumanAccountID(mTxnAccountID);
|
||||
Log(lsWARNING) << "doOfferCreate: uPaysIssuerID=" << NewcoinAddress::createHumanAccountID(uPaysIssuerID);
|
||||
Log(lsWARNING) << "doOfferCreate: uGetsIssuerID=" << NewcoinAddress::createHumanAccountID(uGetsIssuerID);
|
||||
Log(lsWARNING) << "doOfferCreate: sfAccount=" << RippleAddress::createHumanAccountID(mTxnAccountID);
|
||||
Log(lsWARNING) << "doOfferCreate: uPaysIssuerID=" << RippleAddress::createHumanAccountID(uPaysIssuerID);
|
||||
Log(lsWARNING) << "doOfferCreate: uGetsIssuerID=" << RippleAddress::createHumanAccountID(uGetsIssuerID);
|
||||
Log(lsWARNING) << "doOfferCreate: saTakerPays.isNative()=" << saTakerPays.isNative();
|
||||
Log(lsWARNING) << "doOfferCreate: saTakerGets.isNative()=" << saTakerGets.isNative();
|
||||
Log(lsWARNING) << "doOfferCreate: uPaysCurrency=" << saTakerPays.getHumanCurrency();
|
||||
@@ -1161,7 +1161,7 @@ TER TransactionEngine::doOfferCancel(const SerializedTransaction& txn)
|
||||
else
|
||||
{
|
||||
Log(lsWARNING) << "doOfferCancel: offer not found: "
|
||||
<< NewcoinAddress::createHumanAccountID(mTxnAccountID)
|
||||
<< RippleAddress::createHumanAccountID(mTxnAccountID)
|
||||
<< " : " << uOfferSequence
|
||||
<< " : " << uOfferIndex.ToString();
|
||||
|
||||
|
||||
@@ -105,10 +105,10 @@ TER TransactionEngine::applyTransaction(const SerializedTransaction& txn, Transa
|
||||
// without going to disk. Each transaction also notes a source account id. This is used to verify that the signing key is
|
||||
// associated with the account.
|
||||
// XXX This could be a lot cleaner to prevent unnecessary copying.
|
||||
NewcoinAddress naSigningPubKey;
|
||||
RippleAddress naSigningPubKey;
|
||||
|
||||
if (tesSUCCESS == terResult)
|
||||
naSigningPubKey = NewcoinAddress::createAccountPublic(txn.getSigningPubKey());
|
||||
naSigningPubKey = RippleAddress::createAccountPublic(txn.getSigningPubKey());
|
||||
|
||||
// Consistency: really signed.
|
||||
if ((tesSUCCESS == terResult) && !isSetBit(params, tapNO_CHECK_SIGN) && !txn.checkSign(naSigningPubKey))
|
||||
|
||||
@@ -318,7 +318,7 @@ void UniqueNodeList::scoreCompute()
|
||||
|
||||
strIndex::iterator itEntry;
|
||||
|
||||
NewcoinAddress na;
|
||||
RippleAddress na;
|
||||
|
||||
if (na.setNodePublic(strReferral))
|
||||
{
|
||||
@@ -614,7 +614,7 @@ void UniqueNodeList::fetchDirty()
|
||||
// Persist the IPs refered to by a Validator.
|
||||
// --> strSite: source of the IPs (for debugging)
|
||||
// --> naNodePublic: public key of the validating node.
|
||||
void UniqueNodeList::processIps(const std::string& strSite, const NewcoinAddress& naNodePublic, section::mapped_type* pmtVecStrIps)
|
||||
void UniqueNodeList::processIps(const std::string& strSite, const RippleAddress& naNodePublic, section::mapped_type* pmtVecStrIps)
|
||||
{
|
||||
Database* db=theApp->getWalletDB()->getDB();
|
||||
|
||||
@@ -683,7 +683,7 @@ void UniqueNodeList::processIps(const std::string& strSite, const NewcoinAddress
|
||||
// --> strValidatorsSrc: source details for display
|
||||
// --> naNodePublic: remote source public key - not valid for local
|
||||
// --> vsWhy: reason for adding validator to SeedDomains or SeedNodes.
|
||||
int UniqueNodeList::processValidators(const std::string& strSite, const std::string& strValidatorsSrc, const NewcoinAddress& naNodePublic, validatorSource vsWhy, section::mapped_type* pmtVecStrValidators)
|
||||
int UniqueNodeList::processValidators(const std::string& strSite, const std::string& strValidatorsSrc, const RippleAddress& naNodePublic, validatorSource vsWhy, section::mapped_type* pmtVecStrValidators)
|
||||
{
|
||||
Database* db = theApp->getWalletDB()->getDB();
|
||||
std::string strNodePublic = naNodePublic.isValid() ? naNodePublic.humanNodePublic() : strValidatorsSrc;
|
||||
@@ -728,7 +728,7 @@ int UniqueNodeList::processValidators(const std::string& strSite, const std::str
|
||||
{
|
||||
std::string strRefered = smMatch[1];
|
||||
std::string strComment = smMatch[2];
|
||||
NewcoinAddress naValidator;
|
||||
RippleAddress naValidator;
|
||||
|
||||
if (naValidator.setSeedGeneric(strRefered))
|
||||
{
|
||||
@@ -781,7 +781,7 @@ int UniqueNodeList::processValidators(const std::string& strSite, const std::str
|
||||
}
|
||||
|
||||
// Given a section with IPs, parse and persist it for a validator.
|
||||
void UniqueNodeList::responseIps(const std::string& strSite, const NewcoinAddress& naNodePublic, const boost::system::error_code& err, const std::string& strIpsFile)
|
||||
void UniqueNodeList::responseIps(const std::string& strSite, const RippleAddress& naNodePublic, const boost::system::error_code& err, const std::string& strIpsFile)
|
||||
{
|
||||
if (!err)
|
||||
{
|
||||
@@ -795,7 +795,7 @@ void UniqueNodeList::responseIps(const std::string& strSite, const NewcoinAddres
|
||||
|
||||
// Process section [ips_url].
|
||||
// If we have a section with a single entry, fetch the url and process it.
|
||||
void UniqueNodeList::getIpsUrl(const NewcoinAddress& naNodePublic, section secSite)
|
||||
void UniqueNodeList::getIpsUrl(const RippleAddress& naNodePublic, section secSite)
|
||||
{
|
||||
std::string strIpsUrl;
|
||||
std::string strDomain;
|
||||
@@ -821,7 +821,7 @@ void UniqueNodeList::getIpsUrl(const NewcoinAddress& naNodePublic, section secSi
|
||||
}
|
||||
|
||||
// After fetching a ripple.txt from a web site, given a section with validators, parse and persist it.
|
||||
void UniqueNodeList::responseValidators(const std::string& strValidatorsUrl, const NewcoinAddress& naNodePublic, section secSite, const std::string& strSite, const boost::system::error_code& err, const std::string& strValidatorsFile)
|
||||
void UniqueNodeList::responseValidators(const std::string& strValidatorsUrl, const RippleAddress& naNodePublic, section secSite, const std::string& strSite, const boost::system::error_code& err, const std::string& strValidatorsFile)
|
||||
{
|
||||
if (!err)
|
||||
{
|
||||
@@ -834,7 +834,7 @@ void UniqueNodeList::responseValidators(const std::string& strValidatorsUrl, con
|
||||
}
|
||||
|
||||
// Process section [validators_url].
|
||||
void UniqueNodeList::getValidatorsUrl(const NewcoinAddress& naNodePublic, section secSite)
|
||||
void UniqueNodeList::getValidatorsUrl(const RippleAddress& naNodePublic, section secSite)
|
||||
{
|
||||
std::string strValidatorsUrl;
|
||||
std::string strDomain;
|
||||
@@ -860,7 +860,7 @@ void UniqueNodeList::getValidatorsUrl(const NewcoinAddress& naNodePublic, sectio
|
||||
}
|
||||
|
||||
// Process a ripple.txt.
|
||||
void UniqueNodeList::processFile(const std::string& strDomain, const NewcoinAddress& naNodePublic, section secSite)
|
||||
void UniqueNodeList::processFile(const std::string& strDomain, const RippleAddress& naNodePublic, section secSite)
|
||||
{
|
||||
//
|
||||
// Process Validators
|
||||
@@ -943,7 +943,7 @@ void UniqueNodeList::responseFetch(const std::string& strDomain, const boost::sy
|
||||
% strDomain;
|
||||
}
|
||||
|
||||
NewcoinAddress naNodePublic;
|
||||
RippleAddress naNodePublic;
|
||||
|
||||
if (bGood && !naNodePublic.setNodePublic(strNodePublicKey))
|
||||
{
|
||||
@@ -1282,7 +1282,7 @@ void UniqueNodeList::nodeAddDomain(std::string strDomain, validatorSource vsWhy,
|
||||
}
|
||||
|
||||
// Retrieve a SeedNode from DB.
|
||||
bool UniqueNodeList::getSeedNodes(const NewcoinAddress& naNodePublic, seedNode& dstSeedNode)
|
||||
bool UniqueNodeList::getSeedNodes(const RippleAddress& naNodePublic, seedNode& dstSeedNode)
|
||||
{
|
||||
bool bResult;
|
||||
Database* db=theApp->getWalletDB()->getDB();
|
||||
@@ -1384,7 +1384,7 @@ void UniqueNodeList::setSeedNodes(const seedNode& snSource, bool bNext)
|
||||
}
|
||||
|
||||
// Add a trusted node. Called by RPC or other source.
|
||||
void UniqueNodeList::nodeAddPublic(const NewcoinAddress& naNodePublic, validatorSource vsWhy, const std::string& strComment)
|
||||
void UniqueNodeList::nodeAddPublic(const RippleAddress& naNodePublic, validatorSource vsWhy, const std::string& strComment)
|
||||
{
|
||||
seedNode snCurrent;
|
||||
|
||||
@@ -1416,7 +1416,7 @@ void UniqueNodeList::nodeAddPublic(const NewcoinAddress& naNodePublic, validator
|
||||
setSeedNodes(snCurrent, true);
|
||||
}
|
||||
|
||||
void UniqueNodeList::nodeRemovePublic(const NewcoinAddress& naNodePublic)
|
||||
void UniqueNodeList::nodeRemovePublic(const RippleAddress& naNodePublic)
|
||||
{
|
||||
{
|
||||
Database* db=theApp->getWalletDB()->getDB();
|
||||
@@ -1594,7 +1594,7 @@ void UniqueNodeList::nodeBootstrap()
|
||||
// Always load from rippled.cfg
|
||||
if (!theConfig.VALIDATORS.empty())
|
||||
{
|
||||
NewcoinAddress naInvalid; // Don't want a referrer on added entries.
|
||||
RippleAddress naInvalid; // Don't want a referrer on added entries.
|
||||
|
||||
cLog(lsINFO) << "Bootstrapping UNL: loading from " CONFIG_FILE_NAME ".";
|
||||
|
||||
@@ -1649,7 +1649,7 @@ void UniqueNodeList::nodeProcess(const std::string& strSite, const std::string&
|
||||
section::mapped_type* pmtEntries = sectionEntries(secValidators, SECTION_VALIDATORS);
|
||||
if (pmtEntries)
|
||||
{
|
||||
NewcoinAddress naInvalid; // Don't want a referrer on added entries.
|
||||
RippleAddress naInvalid; // Don't want a referrer on added entries.
|
||||
|
||||
// YYY Unspecified might be bootstrap or rpc command
|
||||
processValidators(strSite, strSource, naInvalid, vsValidator, pmtEntries);
|
||||
@@ -1660,7 +1660,7 @@ void UniqueNodeList::nodeProcess(const std::string& strSite, const std::string&
|
||||
}
|
||||
}
|
||||
|
||||
bool UniqueNodeList::nodeInUNL(const NewcoinAddress& naNodePublic)
|
||||
bool UniqueNodeList::nodeInUNL(const RippleAddress& naNodePublic)
|
||||
{
|
||||
ScopedLock sl(mUNLLock);
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
#include "../json/value.h"
|
||||
|
||||
#include "NewcoinAddress.h"
|
||||
#include "RippleAddress.h"
|
||||
#include "Config.h"
|
||||
#include "HttpsClient.h"
|
||||
#include "ParseSection.h"
|
||||
@@ -58,7 +58,7 @@ private:
|
||||
|
||||
typedef struct {
|
||||
std::string strDomain;
|
||||
NewcoinAddress naPublicKey;
|
||||
RippleAddress naPublicKey;
|
||||
validatorSource vsSource;
|
||||
boost::posix_time::ptime tpNext;
|
||||
boost::posix_time::ptime tpScan;
|
||||
@@ -68,7 +68,7 @@ private:
|
||||
} seedDomain;
|
||||
|
||||
typedef struct {
|
||||
NewcoinAddress naPublicKey;
|
||||
RippleAddress naPublicKey;
|
||||
validatorSource vsSource;
|
||||
boost::posix_time::ptime tpNext;
|
||||
boost::posix_time::ptime tpScan;
|
||||
@@ -117,20 +117,20 @@ private:
|
||||
void fetchProcess(std::string strDomain);
|
||||
void fetchTimerHandler(const boost::system::error_code& err);
|
||||
|
||||
void getValidatorsUrl(const NewcoinAddress& naNodePublic, section secSite);
|
||||
void getIpsUrl(const NewcoinAddress& naNodePublic, section secSite);
|
||||
void responseIps(const std::string& strSite, const NewcoinAddress& naNodePublic, const boost::system::error_code& err, const std::string& strIpsFile);
|
||||
void responseValidators(const std::string& strValidatorsUrl, const NewcoinAddress& naNodePublic, section secSite, const std::string& strSite, const boost::system::error_code& err, const std::string& strValidatorsFile);
|
||||
void getValidatorsUrl(const RippleAddress& naNodePublic, section secSite);
|
||||
void getIpsUrl(const RippleAddress& naNodePublic, section secSite);
|
||||
void responseIps(const std::string& strSite, const RippleAddress& naNodePublic, const boost::system::error_code& err, const std::string& strIpsFile);
|
||||
void responseValidators(const std::string& strValidatorsUrl, const RippleAddress& naNodePublic, section secSite, const std::string& strSite, const boost::system::error_code& err, const std::string& strValidatorsFile);
|
||||
|
||||
void processIps(const std::string& strSite, const NewcoinAddress& naNodePublic, section::mapped_type* pmtVecStrIps);
|
||||
int processValidators(const std::string& strSite, const std::string& strValidatorsSrc, const NewcoinAddress& naNodePublic, validatorSource vsWhy, section::mapped_type* pmtVecStrValidators);
|
||||
void processIps(const std::string& strSite, const RippleAddress& naNodePublic, section::mapped_type* pmtVecStrIps);
|
||||
int processValidators(const std::string& strSite, const std::string& strValidatorsSrc, const RippleAddress& naNodePublic, validatorSource vsWhy, section::mapped_type* pmtVecStrValidators);
|
||||
|
||||
void processFile(const std::string& strDomain, const NewcoinAddress& naNodePublic, section secSite);
|
||||
void processFile(const std::string& strDomain, const RippleAddress& naNodePublic, section secSite);
|
||||
|
||||
bool getSeedDomains(const std::string& strDomain, seedDomain& dstSeedDomain);
|
||||
void setSeedDomains(const seedDomain& dstSeedDomain, bool bNext);
|
||||
|
||||
bool getSeedNodes(const NewcoinAddress& naNodePublic, seedNode& dstSeedNode);
|
||||
bool getSeedNodes(const RippleAddress& naNodePublic, seedNode& dstSeedNode);
|
||||
void setSeedNodes(const seedNode& snSource, bool bNext);
|
||||
|
||||
void validatorsResponse(const boost::system::error_code& err, std::string strResponse);
|
||||
@@ -142,15 +142,15 @@ public:
|
||||
// Begin processing.
|
||||
void start();
|
||||
|
||||
void nodeAddPublic(const NewcoinAddress& naNodePublic, validatorSource vsWhy, const std::string& strComment);
|
||||
void nodeAddPublic(const RippleAddress& naNodePublic, validatorSource vsWhy, const std::string& strComment);
|
||||
void nodeAddDomain(std::string strDomain, validatorSource vsWhy, const std::string& strComment="");
|
||||
void nodeRemovePublic(const NewcoinAddress& naNodePublic);
|
||||
void nodeRemovePublic(const RippleAddress& naNodePublic);
|
||||
void nodeRemoveDomain(std::string strDomain);
|
||||
void nodeReset();
|
||||
|
||||
void nodeScore();
|
||||
|
||||
bool nodeInUNL(const NewcoinAddress& naNodePublic);
|
||||
bool nodeInUNL(const RippleAddress& naNodePublic);
|
||||
|
||||
void nodeBootstrap();
|
||||
bool nodeLoad(boost::filesystem::path pConfig);
|
||||
|
||||
@@ -13,7 +13,7 @@ typedef std::pair<const uint160, SerializedValidation::pointer> u160_val_pair;
|
||||
|
||||
bool ValidationCollection::addValidation(const SerializedValidation::pointer& val)
|
||||
{
|
||||
NewcoinAddress signer = val->getSignerPublic();
|
||||
RippleAddress signer = val->getSignerPublic();
|
||||
bool isCurrent = false;
|
||||
if (theApp->getUNL().nodeInUNL(signer) || val->isTrusted())
|
||||
{
|
||||
|
||||
@@ -56,8 +56,8 @@ protected:
|
||||
typedef void (WSConnection::*doFuncPtr)(Json::Value& jvResult, const Json::Value &jvRequest);
|
||||
|
||||
boost::mutex mLock;
|
||||
boost::unordered_set<NewcoinAddress> mSubAccountInfo;
|
||||
boost::unordered_set<NewcoinAddress> mSubAccountTransaction;
|
||||
boost::unordered_set<RippleAddress> mSubAccountInfo;
|
||||
boost::unordered_set<RippleAddress> mSubAccountTransaction;
|
||||
|
||||
WSServerHandler<websocketpp::WSDOOR_SERVER>* mHandler;
|
||||
connection_ptr mConnection;
|
||||
@@ -78,7 +78,7 @@ public:
|
||||
|
||||
// Utilities
|
||||
Json::Value invokeCommand(const Json::Value& jvRequest);
|
||||
boost::unordered_set<NewcoinAddress> parseAccountIds(const Json::Value& jvArray);
|
||||
boost::unordered_set<RippleAddress> parseAccountIds(const Json::Value& jvArray);
|
||||
|
||||
// Commands
|
||||
void doSubmit(Json::Value& jvResult, const Json::Value& jvRequest);
|
||||
@@ -385,13 +385,13 @@ Json::Value WSConnection::invokeCommand(const Json::Value& jvRequest)
|
||||
return jvResult;
|
||||
}
|
||||
|
||||
boost::unordered_set<NewcoinAddress> WSConnection::parseAccountIds(const Json::Value& jvArray)
|
||||
boost::unordered_set<RippleAddress> WSConnection::parseAccountIds(const Json::Value& jvArray)
|
||||
{
|
||||
boost::unordered_set<NewcoinAddress> usnaResult;
|
||||
boost::unordered_set<RippleAddress> usnaResult;
|
||||
|
||||
for (Json::Value::const_iterator it = jvArray.begin(); it != jvArray.end(); it++)
|
||||
{
|
||||
NewcoinAddress naString;
|
||||
RippleAddress naString;
|
||||
|
||||
if (!(*it).isString() || !naString.setAccountID((*it).asString()))
|
||||
{
|
||||
@@ -453,7 +453,7 @@ void WSConnection::doSubscribe(Json::Value& jvResult, const Json::Value& jvReque
|
||||
|
||||
if (jvRequest.isMember("rt_accounts"))
|
||||
{
|
||||
boost::unordered_set<NewcoinAddress> usnaAccoundIds = parseAccountIds(jvRequest["rt_accounts"]);
|
||||
boost::unordered_set<RippleAddress> usnaAccoundIds = parseAccountIds(jvRequest["rt_accounts"]);
|
||||
|
||||
if (usnaAccoundIds.empty())
|
||||
{
|
||||
@@ -462,7 +462,7 @@ void WSConnection::doSubscribe(Json::Value& jvResult, const Json::Value& jvReque
|
||||
{
|
||||
boost::mutex::scoped_lock sl(mLock);
|
||||
|
||||
BOOST_FOREACH(const NewcoinAddress& naAccountID, usnaAccoundIds)
|
||||
BOOST_FOREACH(const RippleAddress& naAccountID, usnaAccoundIds)
|
||||
{
|
||||
mSubAccountInfo.insert(naAccountID);
|
||||
}
|
||||
@@ -473,7 +473,7 @@ void WSConnection::doSubscribe(Json::Value& jvResult, const Json::Value& jvReque
|
||||
|
||||
if (jvRequest.isMember("accounts"))
|
||||
{
|
||||
boost::unordered_set<NewcoinAddress> usnaAccoundIds = parseAccountIds(jvRequest["accounts"]);
|
||||
boost::unordered_set<RippleAddress> usnaAccoundIds = parseAccountIds(jvRequest["accounts"]);
|
||||
|
||||
if (usnaAccoundIds.empty())
|
||||
{
|
||||
@@ -482,7 +482,7 @@ void WSConnection::doSubscribe(Json::Value& jvResult, const Json::Value& jvReque
|
||||
{
|
||||
boost::mutex::scoped_lock sl(mLock);
|
||||
|
||||
BOOST_FOREACH(const NewcoinAddress& naAccountID, usnaAccoundIds)
|
||||
BOOST_FOREACH(const RippleAddress& naAccountID, usnaAccoundIds)
|
||||
{
|
||||
mSubAccountInfo.insert(naAccountID);
|
||||
}
|
||||
@@ -509,7 +509,7 @@ void WSConnection::doAccountInfoSubscribe(Json::Value& jvResult, const Json::Val
|
||||
}
|
||||
else
|
||||
{
|
||||
boost::unordered_set<NewcoinAddress> usnaAccoundIds = parseAccountIds(jvRequest["accounts"]);
|
||||
boost::unordered_set<RippleAddress> usnaAccoundIds = parseAccountIds(jvRequest["accounts"]);
|
||||
|
||||
|
||||
}
|
||||
@@ -527,7 +527,7 @@ void WSConnection::doAccountInfoUnsubscribe(Json::Value& jvResult, const Json::V
|
||||
}
|
||||
else
|
||||
{
|
||||
boost::unordered_set<NewcoinAddress> usnaAccoundIds = parseAccountIds(jvRequest["accounts"]);
|
||||
boost::unordered_set<RippleAddress> usnaAccoundIds = parseAccountIds(jvRequest["accounts"]);
|
||||
|
||||
if (usnaAccoundIds.empty())
|
||||
{
|
||||
@@ -537,7 +537,7 @@ void WSConnection::doAccountInfoUnsubscribe(Json::Value& jvResult, const Json::V
|
||||
{
|
||||
boost::mutex::scoped_lock sl(mLock);
|
||||
|
||||
BOOST_FOREACH(const NewcoinAddress& naAccountID, usnaAccoundIds)
|
||||
BOOST_FOREACH(const RippleAddress& naAccountID, usnaAccoundIds)
|
||||
{
|
||||
mSubAccountInfo.erase(naAccountID);
|
||||
}
|
||||
@@ -559,7 +559,7 @@ void WSConnection::doAccountTransactionSubscribe(Json::Value& jvResult, const Js
|
||||
}
|
||||
else
|
||||
{
|
||||
boost::unordered_set<NewcoinAddress> usnaAccoundIds = parseAccountIds(jvRequest["accounts"]);
|
||||
boost::unordered_set<RippleAddress> usnaAccoundIds = parseAccountIds(jvRequest["accounts"]);
|
||||
|
||||
if (usnaAccoundIds.empty())
|
||||
{
|
||||
@@ -569,7 +569,7 @@ void WSConnection::doAccountTransactionSubscribe(Json::Value& jvResult, const Js
|
||||
{
|
||||
boost::mutex::scoped_lock sl(mLock);
|
||||
|
||||
BOOST_FOREACH(const NewcoinAddress& naAccountID, usnaAccoundIds)
|
||||
BOOST_FOREACH(const RippleAddress& naAccountID, usnaAccoundIds)
|
||||
{
|
||||
mSubAccountTransaction.insert(naAccountID);
|
||||
}
|
||||
@@ -591,7 +591,7 @@ void WSConnection::doAccountTransactionUnsubscribe(Json::Value& jvResult, const
|
||||
}
|
||||
else
|
||||
{
|
||||
boost::unordered_set<NewcoinAddress> usnaAccoundIds = parseAccountIds(jvRequest["accounts"]);
|
||||
boost::unordered_set<RippleAddress> usnaAccoundIds = parseAccountIds(jvRequest["accounts"]);
|
||||
|
||||
if (usnaAccoundIds.empty())
|
||||
{
|
||||
@@ -601,7 +601,7 @@ void WSConnection::doAccountTransactionUnsubscribe(Json::Value& jvResult, const
|
||||
{
|
||||
boost::mutex::scoped_lock sl(mLock);
|
||||
|
||||
BOOST_FOREACH(const NewcoinAddress& naAccountID, usnaAccoundIds)
|
||||
BOOST_FOREACH(const RippleAddress& naAccountID, usnaAccoundIds)
|
||||
{
|
||||
mSubAccountTransaction.erase(naAccountID);
|
||||
}
|
||||
@@ -715,7 +715,7 @@ void WSConnection::doLedgerEntry(Json::Value& jvResult, const Json::Value& jvReq
|
||||
}
|
||||
else if (jvRequest.isMember("account_root"))
|
||||
{
|
||||
NewcoinAddress naAccount;
|
||||
RippleAddress naAccount;
|
||||
|
||||
if (!naAccount.setAccountID(jvRequest["account_root"].asString())
|
||||
|| !naAccount.getAccountID())
|
||||
@@ -755,7 +755,7 @@ void WSConnection::doLedgerEntry(Json::Value& jvResult, const Json::Value& jvReq
|
||||
}
|
||||
else if (jvRequest["directory"].isMember("owner"))
|
||||
{
|
||||
NewcoinAddress naOwnerID;
|
||||
RippleAddress naOwnerID;
|
||||
|
||||
if (!naOwnerID.setAccountID(jvRequest["directory"]["owner"].asString()))
|
||||
{
|
||||
@@ -776,7 +776,7 @@ void WSConnection::doLedgerEntry(Json::Value& jvResult, const Json::Value& jvReq
|
||||
}
|
||||
else if (jvRequest.isMember("generator"))
|
||||
{
|
||||
NewcoinAddress naGeneratorID;
|
||||
RippleAddress naGeneratorID;
|
||||
|
||||
if (!jvRequest.isObject())
|
||||
{
|
||||
@@ -792,8 +792,8 @@ void WSConnection::doLedgerEntry(Json::Value& jvResult, const Json::Value& jvReq
|
||||
}
|
||||
else
|
||||
{
|
||||
NewcoinAddress na0Public; // To find the generator's index.
|
||||
NewcoinAddress naGenerator = NewcoinAddress::createGeneratorPublic(naGeneratorID);
|
||||
RippleAddress na0Public; // To find the generator's index.
|
||||
RippleAddress naGenerator = RippleAddress::createGeneratorPublic(naGeneratorID);
|
||||
|
||||
na0Public.setAccountPublic(naGenerator, 0);
|
||||
|
||||
@@ -802,7 +802,7 @@ void WSConnection::doLedgerEntry(Json::Value& jvResult, const Json::Value& jvReq
|
||||
}
|
||||
else if (jvRequest.isMember("offer"))
|
||||
{
|
||||
NewcoinAddress naAccountID;
|
||||
RippleAddress naAccountID;
|
||||
|
||||
if (!jvRequest.isObject())
|
||||
{
|
||||
@@ -827,8 +827,8 @@ void WSConnection::doLedgerEntry(Json::Value& jvResult, const Json::Value& jvReq
|
||||
}
|
||||
else if (jvRequest.isMember("ripple_state"))
|
||||
{
|
||||
NewcoinAddress naA;
|
||||
NewcoinAddress naB;
|
||||
RippleAddress naA;
|
||||
RippleAddress naB;
|
||||
uint160 uCurrency;
|
||||
Json::Value jvRippleState = jvRequest["ripple_state"];
|
||||
|
||||
@@ -938,7 +938,7 @@ void WSConnection::doRPC(Json::Value& jvResult, const Json::Value& jvRequest)
|
||||
// XXX Current requires secret. Allow signed transaction as an alternative.
|
||||
void WSConnection::doSubmit(Json::Value& jvResult, const Json::Value& jvRequest)
|
||||
{
|
||||
NewcoinAddress naAccount;
|
||||
RippleAddress naAccount;
|
||||
|
||||
if (!jvRequest.isMember("transaction"))
|
||||
{
|
||||
@@ -970,7 +970,7 @@ void WSConnection::doSubmit(Json::Value& jvResult, const Json::Value& jvRequest)
|
||||
}
|
||||
|
||||
bool bHaveAuthKey = false;
|
||||
NewcoinAddress naAuthorizedPublic;
|
||||
RippleAddress naAuthorizedPublic;
|
||||
#if 0
|
||||
|
||||
if (sleAccountRoot->isFieldPresent(sfAuthorizedKey))
|
||||
@@ -980,11 +980,11 @@ void WSConnection::doSubmit(Json::Value& jvResult, const Json::Value& jvRequest)
|
||||
}
|
||||
#endif
|
||||
|
||||
NewcoinAddress naSecret = NewcoinAddress::createSeedGeneric(jvRequest["secret"].asString());
|
||||
NewcoinAddress naMasterGenerator = NewcoinAddress::createGeneratorPublic(naSecret);
|
||||
RippleAddress naSecret = RippleAddress::createSeedGeneric(jvRequest["secret"].asString());
|
||||
RippleAddress naMasterGenerator = RippleAddress::createGeneratorPublic(naSecret);
|
||||
|
||||
// Find the index of Account from the master generator, so we can generate the public and private keys.
|
||||
NewcoinAddress naMasterAccountPublic;
|
||||
RippleAddress naMasterAccountPublic;
|
||||
unsigned int iIndex = 0;
|
||||
bool bFound = false;
|
||||
|
||||
@@ -1008,9 +1008,9 @@ void WSConnection::doSubmit(Json::Value& jvResult, const Json::Value& jvRequest)
|
||||
}
|
||||
|
||||
// Use the generator to determine the associated public and private keys.
|
||||
NewcoinAddress naGenerator = NewcoinAddress::createGeneratorPublic(naSecret);
|
||||
NewcoinAddress naAccountPublic = NewcoinAddress::createAccountPublic(naGenerator, iIndex);
|
||||
NewcoinAddress naAccountPrivate = NewcoinAddress::createAccountPrivate(naGenerator, naSecret, iIndex);
|
||||
RippleAddress naGenerator = RippleAddress::createGeneratorPublic(naSecret);
|
||||
RippleAddress naAccountPublic = RippleAddress::createAccountPublic(naGenerator, iIndex);
|
||||
RippleAddress naAccountPrivate = RippleAddress::createAccountPrivate(naGenerator, naSecret, iIndex);
|
||||
|
||||
if (bHaveAuthKey
|
||||
// The generated pair must match authorized...
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#include "Wallet.h"
|
||||
#include "Ledger.h"
|
||||
#include "NewcoinAddress.h"
|
||||
#include "RippleAddress.h"
|
||||
#include "Application.h"
|
||||
#include "utils.h"
|
||||
|
||||
@@ -69,9 +69,9 @@ bool Wallet::nodeIdentityCreate() {
|
||||
//
|
||||
// Generate the public and private key
|
||||
//
|
||||
NewcoinAddress naSeed = NewcoinAddress::createSeedRandom();
|
||||
NewcoinAddress naNodePublic = NewcoinAddress::createNodePublic(naSeed);
|
||||
NewcoinAddress naNodePrivate = NewcoinAddress::createNodePrivate(naSeed);
|
||||
RippleAddress naSeed = RippleAddress::createSeedRandom();
|
||||
RippleAddress naNodePublic = RippleAddress::createNodePublic(naSeed);
|
||||
RippleAddress naNodePrivate = RippleAddress::createNodePrivate(naSeed);
|
||||
|
||||
// Make new key.
|
||||
|
||||
|
||||
@@ -31,8 +31,8 @@ private:
|
||||
protected:
|
||||
boost::recursive_mutex mLock;
|
||||
|
||||
NewcoinAddress mNodePublicKey;
|
||||
NewcoinAddress mNodePrivateKey;
|
||||
RippleAddress mNodePublicKey;
|
||||
RippleAddress mNodePrivateKey;
|
||||
DH* mDh512;
|
||||
DH* mDh1024;
|
||||
|
||||
@@ -45,8 +45,8 @@ public:
|
||||
// - Maintain peer connectivity through validation and peer management.
|
||||
void start();
|
||||
|
||||
const NewcoinAddress& getNodePublic() const { return mNodePublicKey; }
|
||||
const NewcoinAddress& getNodePrivate() const { return mNodePrivateKey; }
|
||||
const RippleAddress& getNodePublic() const { return mNodePublicKey; }
|
||||
const RippleAddress& getNodePrivate() const { return mNodePrivateKey; }
|
||||
DH* getDh512() { return DHparams_dup(mDh512); }
|
||||
DH* getDh1024() { return DHparams_dup(mDh1024); }
|
||||
|
||||
|
||||
14
src/key.h
14
src/key.h
@@ -16,7 +16,7 @@
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#include "SecureAllocator.h"
|
||||
#include "NewcoinAddress.h"
|
||||
#include "RippleAddress.h"
|
||||
#include "uint256.h"
|
||||
#include "base58.h"
|
||||
|
||||
@@ -124,9 +124,9 @@ public:
|
||||
static uint128 PassPhraseToKey(const std::string& passPhrase);
|
||||
static EC_KEY* GenerateRootDeterministicKey(const uint128& passPhrase);
|
||||
static EC_KEY* GenerateRootPubKey(BIGNUM* pubGenerator);
|
||||
static EC_KEY* GeneratePublicDeterministicKey(const NewcoinAddress& generator, int n);
|
||||
static EC_KEY* GeneratePrivateDeterministicKey(const NewcoinAddress& family, const BIGNUM* rootPriv, int n);
|
||||
static EC_KEY* GeneratePrivateDeterministicKey(const NewcoinAddress& family, const uint256& rootPriv, int n);
|
||||
static EC_KEY* GeneratePublicDeterministicKey(const RippleAddress& generator, int n);
|
||||
static EC_KEY* GeneratePrivateDeterministicKey(const RippleAddress& family, const BIGNUM* rootPriv, int n);
|
||||
static EC_KEY* GeneratePrivateDeterministicKey(const RippleAddress& family, const uint256& rootPriv, int n);
|
||||
|
||||
CKey(const uint128& passPhrase) : fSet(false)
|
||||
{
|
||||
@@ -135,14 +135,14 @@ public:
|
||||
assert(pkey);
|
||||
}
|
||||
|
||||
CKey(const NewcoinAddress& generator, int n) : fSet(false)
|
||||
CKey(const RippleAddress& generator, int n) : fSet(false)
|
||||
{ // public deterministic key
|
||||
pkey = GeneratePublicDeterministicKey(generator, n);
|
||||
fSet = true;
|
||||
assert(pkey);
|
||||
}
|
||||
|
||||
CKey(const NewcoinAddress& base, const BIGNUM* rootPrivKey, int n) : fSet(false)
|
||||
CKey(const RippleAddress& base, const BIGNUM* rootPrivKey, int n) : fSet(false)
|
||||
{ // private deterministic key
|
||||
pkey = GeneratePrivateDeterministicKey(base, rootPrivKey, n);
|
||||
fSet = true;
|
||||
@@ -156,7 +156,7 @@ public:
|
||||
}
|
||||
|
||||
#if 0
|
||||
CKey(const NewcoinAddress& masterKey, int keyNum, bool isPublic) : pkey(NULL), fSet(false)
|
||||
CKey(const RippleAddress& masterKey, int keyNum, bool isPublic) : pkey(NULL), fSet(false)
|
||||
{
|
||||
if (isPublic)
|
||||
SetPubSeq(masterKey, keyNum);
|
||||
|
||||
Reference in New Issue
Block a user