Merge branch 'testnet'

This commit is contained in:
Arthur Britto
2013-01-02 23:03:06 -08:00
16 changed files with 123 additions and 55 deletions

10
README
View File

@@ -1,10 +0,0 @@
Dependancies:
- boost 1.47
- Google protocol buffers 2.4.1
- openssl
Sub modules:
- websocketpp: https://github.com/zaphoyd/websocketpp
- sjcl: https://github.com/bitwiseshiftleft/sjcl
- cryptojs: https://github.com/gwjjeff/cryptojs
aka http://code.google.com/p/crypto-js/

18
README.md Normal file
View File

@@ -0,0 +1,18 @@
Ripple - P2P Payment Network
============================
Some portions of this source code are currently closed source.
This the repository for Ripple's:
* rippled - P2P network server
* ripple.js - JavaScript client libraries.
Build instructions:
* See: https://ripple.com/wiki/Rippled_build_instructions
Setup instructions:
* See: https://ripple.com/wiki/Rippled_setup_instructions
For more information:
* See: https://ripple.com
* See: https://ripple.com/wiki

View File

@@ -4,6 +4,7 @@
#include "Config.h" #include "Config.h"
#include "utils.h" #include "utils.h"
#include "HashPrefixes.h"
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
@@ -56,10 +57,12 @@
#define DEFAULT_FEE_OPERATION 1 #define DEFAULT_FEE_OPERATION 1
Config theConfig; Config theConfig;
const char* ALPHABET;
void Config::setup(const std::string& strConf, bool bQuiet) void Config::setup(const std::string& strConf, bool bTestNet, bool bQuiet)
{ {
boost::system::error_code ec; boost::system::error_code ec;
std::string strDbPath, strConfFile;
// //
// Determine the config and data directories. // Determine the config and data directories.
@@ -67,21 +70,39 @@ void Config::setup(const std::string& strConf, bool bQuiet)
// that with "db" as the data directory. // that with "db" as the data directory.
// //
TESTNET = bTestNet;
QUIET = bQuiet; QUIET = bQuiet;
// TESTNET forces a "test-" prefix on the conf file and db directory.
strDbPath = TESTNET ? "test-db" : "db";
strConfFile = boost::str(boost::format(TESTNET ? "test-%s" : "%s")
% (strConf.empty() ? CONFIG_FILE_NAME : strConf));
VALIDATORS_BASE = boost::str(boost::format(TESTNET ? "test-%s" : "%s")
% VALIDATORS_FILE_NAME);
VALIDATORS_URI = boost::str(boost::format("/%s") % VALIDATORS_BASE);
SIGN_TRANSACTION = TESTNET ? sHP_TestNetTransactionSign : sHP_TransactionSign;
SIGN_VALIDATION = TESTNET ? sHP_TestNetValidation : sHP_Validation;
SIGN_PROPOSAL = TESTNET ? sHP_TestNetProposal : sHP_Proposal;
ALPHABET = TESTNET
? "RPShNAF39wBUDnEGHJKLM4pQrsT7VWXYZ2bcdeCg65jkm8ofqi1tuvaxyz"
: "rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz";
if (!strConf.empty()) if (!strConf.empty())
{ {
// --conf=<path> : everything is relative that file. // --conf=<path> : everything is relative that file.
CONFIG_FILE = strConf; CONFIG_FILE = strConfFile;
CONFIG_DIR = CONFIG_FILE; CONFIG_DIR = CONFIG_FILE;
CONFIG_DIR.remove_filename(); CONFIG_DIR.remove_filename();
DATA_DIR = CONFIG_DIR / "db"; DATA_DIR = CONFIG_DIR / strDbPath;
} }
else else
{ {
CONFIG_DIR = boost::filesystem::current_path(); CONFIG_DIR = boost::filesystem::current_path();
CONFIG_FILE = CONFIG_DIR / CONFIG_FILE_NAME; CONFIG_FILE = CONFIG_DIR / strConfFile;
DATA_DIR = CONFIG_DIR / "db"; DATA_DIR = CONFIG_DIR / strDbPath;
if (exists(CONFIG_FILE) if (exists(CONFIG_FILE)
// Can we figure out XDG dirs? // Can we figure out XDG dirs?
@@ -111,7 +132,7 @@ void Config::setup(const std::string& strConf, bool bQuiet)
} }
CONFIG_DIR = str(boost::format("%s/" SYSTEM_NAME) % strXdgConfigHome); CONFIG_DIR = str(boost::format("%s/" SYSTEM_NAME) % strXdgConfigHome);
CONFIG_FILE = CONFIG_DIR / CONFIG_FILE_NAME; CONFIG_FILE = CONFIG_DIR / strConfFile;
DATA_DIR = str(boost::format("%s/" SYSTEM_NAME) % strXdgDataHome); DATA_DIR = str(boost::format("%s/" SYSTEM_NAME) % strXdgDataHome);
boost::filesystem::create_directories(CONFIG_DIR, ec); boost::filesystem::create_directories(CONFIG_DIR, ec);
@@ -140,6 +161,7 @@ Config::Config()
// Defaults // Defaults
// //
TESTNET = false;
NETWORK_START_TIME = 1319844908; NETWORK_START_TIME = 1319844908;
PEER_PORT = SYSTEM_PEER_PORT; PEER_PORT = SYSTEM_PEER_PORT;

View File

@@ -19,7 +19,7 @@
#define SYSTEM_CURRENCY_PARTS 1000000ull // 10^SYSTEM_CURRENCY_PRECISION #define SYSTEM_CURRENCY_PARTS 1000000ull // 10^SYSTEM_CURRENCY_PRECISION
#define SYSTEM_CURRENCY_START (SYSTEM_CURRENCY_GIFT*SYSTEM_CURRENCY_USERS*SYSTEM_CURRENCY_PARTS) #define SYSTEM_CURRENCY_START (SYSTEM_CURRENCY_GIFT*SYSTEM_CURRENCY_USERS*SYSTEM_CURRENCY_PARTS)
#define CONFIG_FILE_NAME SYSTEM_NAME "d.cfg" // rippled.cfg #define CONFIG_FILE_NAME SYSTEM_NAME "d.cfg" // rippled.cfg
#define DEFAULT_VALIDATORS_SITE "" #define DEFAULT_VALIDATORS_SITE ""
#define VALIDATORS_FILE_NAME "validators.txt" #define VALIDATORS_FILE_NAME "validators.txt"
@@ -47,14 +47,17 @@ class Config
public: public:
// Configuration parameters // Configuration parameters
bool QUIET; bool QUIET;
bool TESTNET;
boost::filesystem::path CONFIG_FILE; boost::filesystem::path CONFIG_FILE;
boost::filesystem::path CONFIG_DIR; boost::filesystem::path CONFIG_DIR;
boost::filesystem::path DATA_DIR; boost::filesystem::path DATA_DIR;
boost::filesystem::path DEBUG_LOGFILE; boost::filesystem::path DEBUG_LOGFILE;
boost::filesystem::path VALIDATORS_FILE; boost::filesystem::path VALIDATORS_FILE; // As specifed in rippled.cfg.
std::string VALIDATORS_SITE; // Where to find validators.txt on the Internet. std::string VALIDATORS_SITE; // Where to find validators.txt on the Internet.
std::string VALIDATORS_URI; // URI of validators.txt.
std::string VALIDATORS_BASE; // Name with testnet-, if needed.
std::vector<std::string> VALIDATORS; // Validators from rippled.cfg. std::vector<std::string> VALIDATORS; // Validators from rippled.cfg.
std::vector<std::string> IPS; // Peer IPs from rippled.cfg. std::vector<std::string> IPS; // Peer IPs from rippled.cfg.
std::vector<std::string> SNTP_SERVERS; // SNTP servers from rippled.cfg. std::vector<std::string> SNTP_SERVERS; // SNTP servers from rippled.cfg.
@@ -120,12 +123,19 @@ public:
// Client behavior // Client behavior
int ACCOUNT_PROBE_MAX; // How far to scan for accounts. int ACCOUNT_PROBE_MAX; // How far to scan for accounts.
// Signing signatures.
uint32 SIGN_TRANSACTION;
uint32 SIGN_VALIDATION;
uint32 SIGN_PROPOSAL;
Config(); Config();
void setup(const std::string& strConf, bool bQuiet);
void setup(const std::string& strConf, bool bTestNet, bool bQuiet);
void load(); void load();
}; };
extern Config theConfig; extern Config theConfig;
#endif #endif
// vim:ts=4 // vim:ts=4

View File

@@ -6,9 +6,6 @@
// TXN - Hash of transaction plus signature to give transaction ID // TXN - Hash of transaction plus signature to give transaction ID
const uint32 sHP_TransactionID = 0x54584E00; const uint32 sHP_TransactionID = 0x54584E00;
// STX - Hash of inner transaction to sign
const uint32 sHP_TransactionSign = 0x53545800;
// TND - Hash of transaction plus metadata // TND - Hash of transaction plus metadata
const uint32 sHP_TransactionNode = 0x534E4400; const uint32 sHP_TransactionNode = 0x534E4400;
@@ -21,12 +18,24 @@ const uint32 sHP_InnerNode = 0x4D494E00;
// LGR - Hash of ledger master data for signing // LGR - Hash of ledger master data for signing
const uint32 sHP_Ledger = 0x4C575200; const uint32 sHP_Ledger = 0x4C575200;
// STX - Hash of inner transaction to sign
const uint32 sHP_TransactionSign = 0x53545800;
// VAL - Hash of validation for signing // VAL - Hash of validation for signing
const uint32 sHP_Validation = 0x56414C00; const uint32 sHP_Validation = 0x56414C00;
// PRP - Hash of proposal for signing // PRP - Hash of proposal for signing
const uint32 sHP_Proposal = 0x50525000; const uint32 sHP_Proposal = 0x50525000;
// stx - TESTNET Hash of inner transaction to sign
const uint32 sHP_TestNetTransactionSign = 0x73747800;
// val - TESTNET Hash of validation for signing
const uint32 sHP_TestNetValidation = 0x76616C00;
// prp - TESTNET Hash of proposal for signing
const uint32 sHP_TestNetProposal = 0x70727000;
#endif #endif
// vim:ts=4 // vim:ts=4

View File

@@ -42,7 +42,7 @@ uint256 LedgerProposal::getSigningHash() const
{ {
Serializer s((32 + 32 + 32 + 256 + 256) / 8); Serializer s((32 + 32 + 32 + 256 + 256) / 8);
s.add32(sHP_Proposal); s.add32(theConfig.SIGN_PROPOSAL);
s.add32(mProposeSeq); s.add32(mProposeSeq);
s.add32(mCloseTime); s.add32(mCloseTime);
s.add256(mPreviousLedger); s.add256(mPreviousLedger);

View File

@@ -1079,6 +1079,9 @@ Json::Value NetworkOPs::getServerInfo()
{ {
Json::Value info = Json::objectValue; Json::Value info = Json::objectValue;
if (theConfig.TESTNET)
info["testnet"] = theConfig.TESTNET;
switch (mMode) switch (mMode)
{ {
case omDISCONNECTED: info["serverState"] = "disconnected"; break; case omDISCONNECTED: info["serverState"] = "disconnected"; break;
@@ -1455,7 +1458,11 @@ bool NetworkOPs::subServer(InfoSub* ispListener, Json::Value& jvResult)
{ {
uint256 uRandom; uint256 uRandom;
jvResult["stand_alone"] = theConfig.RUN_STANDALONE; if (theConfig.RUN_STANDALONE)
jvResult["stand_alone"] = theConfig.RUN_STANDALONE;
if (theConfig.TESTNET)
jvResult["testnet"] = theConfig.TESTNET;
getRand(uRandom.begin(), uRandom.size()); getRand(uRandom.begin(), uRandom.size());
jvResult["random"] = uRandom.ToString(); jvResult["random"] = uRandom.ToString();

View File

@@ -627,7 +627,14 @@ void Peer::recvHello(ripple::TMHello& packet)
} }
#endif #endif
if (packet.has_nettime() && ((packet.nettime() < minTime) || (packet.nettime() > maxTime))) if ((packet.has_testnet() && packet.testnet()) != theConfig.TESTNET)
{
// Format: actual/requested.
cLog(lsINFO) << boost::str(boost::format("Recv(Hello): Network mismatch: %d/%d")
% packet.testnet()
% theConfig.TESTNET);
}
else if (packet.has_nettime() && ((packet.nettime() < minTime) || (packet.nettime() > maxTime)))
{ {
if (packet.nettime() > maxTime) if (packet.nettime() > maxTime)
{ {
@@ -1619,6 +1626,7 @@ void Peer::sendHello()
h.set_nodeproof(&vchSig[0], vchSig.size()); h.set_nodeproof(&vchSig[0], vchSig.size());
h.set_ipv4port(theConfig.PEER_PORT); h.set_ipv4port(theConfig.PEER_PORT);
h.set_nodeprivate(theConfig.PEER_PRIVATE); h.set_nodeprivate(theConfig.PEER_PRIVATE);
h.set_testnet(theConfig.TESTNET);
Ledger::pointer closedLedger = theApp->getLedgerMaster().getClosedLedger(); Ledger::pointer closedLedger = theApp->getLedgerMaster().getClosedLedger();
if (closedLedger && closedLedger->isClosed()) if (closedLedger && closedLedger->isClosed())

View File

@@ -126,7 +126,7 @@ std::vector<RippleAddress> SerializedTransaction::getAffectedAccounts() const
uint256 SerializedTransaction::getSigningHash() const uint256 SerializedTransaction::getSigningHash() const
{ {
return STObject::getSigningHash(sHP_TransactionSign); return STObject::getSigningHash(theConfig.SIGN_TRANSACTION);
} }
uint256 SerializedTransaction::getTransactionID() const uint256 SerializedTransaction::getTransactionID() const

View File

@@ -1,7 +1,7 @@
#include "SerializedValidation.h" #include "SerializedValidation.h"
#include "HashPrefixes.h" #include "Config.h"
#include "Log.h" #include "Log.h"
DECLARE_INSTANCE(SerializedValidation); DECLARE_INSTANCE(SerializedValidation);
@@ -70,7 +70,7 @@ void SerializedValidation::sign(uint256& signingHash, const RippleAddress& raPri
uint256 SerializedValidation::getSigningHash() const uint256 SerializedValidation::getSigningHash() const
{ {
return STObject::getSigningHash(sHP_Validation); return STObject::getSigningHash(theConfig.SIGN_VALIDATION);
} }
uint256 SerializedValidation::getLedgerHash() const uint256 SerializedValidation::getLedgerHash() const

View File

@@ -3,6 +3,7 @@
#include "UniqueNodeList.h" #include "UniqueNodeList.h"
#include <algorithm>
#include <fstream> #include <fstream>
#include <iostream> #include <iostream>
@@ -24,7 +25,6 @@
SETUP_LOG(); SETUP_LOG();
#define VALIDATORS_FETCH_SECONDS 30 #define VALIDATORS_FETCH_SECONDS 30
#define VALIDATORS_FILE_PATH "/" VALIDATORS_FILE_NAME
#define VALIDATORS_FILE_BYTES_MAX (50 << 10) #define VALIDATORS_FILE_BYTES_MAX (50 << 10)
// Gather string constants. // Gather string constants.
@@ -41,10 +41,6 @@ SETUP_LOG();
#define REFERRAL_VALIDATORS_MAX 50 #define REFERRAL_VALIDATORS_MAX 50
#define REFERRAL_IPS_MAX 50 #define REFERRAL_IPS_MAX 50
#ifndef MIN
#define MIN(x,y) ((x)<(y)?(x):(y))
#endif
UniqueNodeList::UniqueNodeList(boost::asio::io_service& io_service) : UniqueNodeList::UniqueNodeList(boost::asio::io_service& io_service) :
mdtScoreTimer(io_service), mdtScoreTimer(io_service),
mFetchActive(0), mFetchActive(0),
@@ -633,9 +629,9 @@ void UniqueNodeList::processIps(const std::string& strSite, const RippleAddress&
// Add new referral entries. // Add new referral entries.
if (pmtVecStrIps && !pmtVecStrIps->empty()) { if (pmtVecStrIps && !pmtVecStrIps->empty()) {
std::vector<std::string> vstrValues; std::vector<std::string> vstrValues;
vstrValues.resize(MIN(pmtVecStrIps->size(), REFERRAL_IPS_MAX)); vstrValues.resize(std::min((int) pmtVecStrIps->size(), REFERRAL_IPS_MAX));
int iValues = 0; int iValues = 0;
BOOST_FOREACH(const std::string& strReferral, *pmtVecStrIps) BOOST_FOREACH(const std::string& strReferral, *pmtVecStrIps)
@@ -707,7 +703,7 @@ int UniqueNodeList::processValidators(const std::string& strSite, const std::str
if (pmtVecStrValidators && pmtVecStrValidators->size()) { if (pmtVecStrValidators && pmtVecStrValidators->size()) {
std::vector<std::string> vstrValues; std::vector<std::string> vstrValues;
vstrValues.reserve(MIN(pmtVecStrValidators->size(), REFERRAL_VALIDATORS_MAX)); vstrValues.reserve(std::min((int) pmtVecStrValidators->size(), REFERRAL_VALIDATORS_MAX));
BOOST_FOREACH(const std::string& strReferral, *pmtVecStrValidators) BOOST_FOREACH(const std::string& strReferral, *pmtVecStrValidators)
{ {
@@ -1555,13 +1551,13 @@ void UniqueNodeList::validatorsResponse(const boost::system::error_code& err, st
void UniqueNodeList::nodeNetwork() void UniqueNodeList::nodeNetwork()
{ {
if(!theConfig.VALIDATORS_SITE.empty()) if (!theConfig.VALIDATORS_SITE.empty())
{ {
HttpsClient::httpsGet( HttpsClient::httpsGet(
theApp->getIOService(), theApp->getIOService(),
theConfig.VALIDATORS_SITE, theConfig.VALIDATORS_SITE,
443, 443,
VALIDATORS_FILE_PATH, theConfig.VALIDATORS_URI,
VALIDATORS_FILE_BYTES_MAX, VALIDATORS_FILE_BYTES_MAX,
boost::posix_time::seconds(VALIDATORS_FETCH_SECONDS), boost::posix_time::seconds(VALIDATORS_FETCH_SECONDS),
boost::bind(&UniqueNodeList::validatorsResponse, this, _1, _2)); boost::bind(&UniqueNodeList::validatorsResponse, this, _1, _2));
@@ -1597,9 +1593,10 @@ void UniqueNodeList::nodeBootstrap()
// If never loaded anything try the current directory. // If never loaded anything try the current directory.
if (!bLoaded && theConfig.VALIDATORS_FILE.empty()) if (!bLoaded && theConfig.VALIDATORS_FILE.empty())
{ {
cLog(lsINFO) << "Bootstrapping UNL: loading from '" VALIDATORS_FILE_NAME "'."; cLog(lsINFO) << boost::str(boost::format("Bootstrapping UNL: loading from '%s'.")
% theConfig.VALIDATORS_BASE);
bLoaded = nodeLoad(VALIDATORS_FILE_NAME); bLoaded = nodeLoad(theConfig.VALIDATORS_BASE);
} }
// Always load from rippled.cfg // Always load from rippled.cfg
@@ -1607,15 +1604,17 @@ void UniqueNodeList::nodeBootstrap()
{ {
RippleAddress 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 "."; cLog(lsINFO) << boost::str(boost::format("Bootstrapping UNL: loading from '%s'.")
% theConfig.CONFIG_FILE);
if (processValidators("local", CONFIG_FILE_NAME, naInvalid, vsConfig, &theConfig.VALIDATORS)) if (processValidators("local", theConfig.CONFIG_FILE.native(), naInvalid, vsConfig, &theConfig.VALIDATORS))
bLoaded = true; bLoaded = true;
} }
if (!bLoaded) if (!bLoaded)
{ {
cLog(lsINFO) << "Bootstrapping UNL: loading from " << theConfig.VALIDATORS_SITE << "."; cLog(lsINFO) << boost::str(boost::format("Bootstrapping UNL: loading from '%s'.")
% theConfig.VALIDATORS_SITE);
nodeNetwork(); nodeNetwork();
} }
@@ -1667,7 +1666,8 @@ void UniqueNodeList::nodeProcess(const std::string& strSite, const std::string&
} }
else else
{ {
cLog(lsWARNING) << "'" VALIDATORS_FILE_NAME "' missing [" SECTION_VALIDATORS "]."; cLog(lsWARNING) << boost::str(boost::format("'%s' missing [" SECTION_VALIDATORS "].")
% theConfig.VALIDATORS_BASE);
} }
} }

View File

@@ -23,7 +23,7 @@
#include "bignum.h" #include "bignum.h"
#include "BitcoinUtil.h" #include "BitcoinUtil.h"
static const char* pszBase58 = "rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz"; extern const char* ALPHABET;
inline std::string EncodeBase58(const unsigned char* pbegin, const unsigned char* pend) inline std::string EncodeBase58(const unsigned char* pbegin, const unsigned char* pend)
{ {
@@ -52,12 +52,12 @@ inline std::string EncodeBase58(const unsigned char* pbegin, const unsigned char
throw bignum_error("EncodeBase58 : BN_div failed"); throw bignum_error("EncodeBase58 : BN_div failed");
bn = dv; bn = dv;
unsigned int c = rem.getulong(); unsigned int c = rem.getulong();
str += pszBase58[c]; str += ALPHABET[c];
} }
// Leading zeroes encoded as base58 zeros // Leading zeroes encoded as base58 zeros
for (const unsigned char* p = pbegin; p < pend && *p == 0; p++) for (const unsigned char* p = pbegin; p < pend && *p == 0; p++)
str += pszBase58[0]; str += ALPHABET[0];
// Convert little endian std::string to big endian // Convert little endian std::string to big endian
reverse(str.begin(), str.end()); reverse(str.begin(), str.end());
@@ -82,7 +82,7 @@ inline bool DecodeBase58(const char* psz, std::vector<unsigned char>& vchRet)
// Convert big endian string to bignum // Convert big endian string to bignum
for (const char* p = psz; *p; p++) for (const char* p = psz; *p; p++)
{ {
const char* p1 = strchr(pszBase58, *p); const char* p1 = strchr(ALPHABET, *p);
if (p1 == NULL) if (p1 == NULL)
{ {
while (isspace(*p)) while (isspace(*p))
@@ -91,7 +91,7 @@ inline bool DecodeBase58(const char* psz, std::vector<unsigned char>& vchRet)
return false; return false;
break; break;
} }
bnChar.setulong(p1 - pszBase58); bnChar.setulong(p1 - ALPHABET);
if (!BN_mul(&bn, &bn, &bn58, pctx)) if (!BN_mul(&bn, &bn, &bn58, pctx))
throw bignum_error("DecodeBase58 : BN_mul failed"); throw bignum_error("DecodeBase58 : BN_mul failed");
bn += bnChar; bn += bnChar;
@@ -106,7 +106,7 @@ inline bool DecodeBase58(const char* psz, std::vector<unsigned char>& vchRet)
// Restore leading zeros // Restore leading zeros
int nLeadingZeros = 0; int nLeadingZeros = 0;
for (const char* p = psz; *p == pszBase58[0]; p++) for (const char* p = psz; *p == ALPHABET[0]; p++)
nLeadingZeros++; nLeadingZeros++;
vchRet.assign(nLeadingZeros + vchTmp.size(), 0); vchRet.assign(nLeadingZeros + vchTmp.size(), 0);

View File

@@ -120,7 +120,6 @@ int main(int argc, char* argv[])
iResult = 2; iResult = 2;
} }
if (iResult) if (iResult)
{ {
nothing(); nothing();
@@ -154,6 +153,7 @@ int main(int argc, char* argv[])
if (vm.count("unittest")) if (vm.count("unittest"))
{ {
unit_test_main(init_unit_test, argc, argv); unit_test_main(init_unit_test, argc, argv);
return 0; return 0;
} }
@@ -161,6 +161,7 @@ int main(int argc, char* argv[])
{ {
theConfig.setup( theConfig.setup(
vm.count("conf") ? vm["conf"].as<std::string>() : "", // Config file. vm.count("conf") ? vm["conf"].as<std::string>() : "", // Config file.
!!vm.count("testnet"), // Testnet flag.
!!vm.count("quiet")); // Quiet flag. !!vm.count("quiet")); // Quiet flag.
if (vm.count("standalone")) if (vm.count("standalone"))

View File

@@ -71,6 +71,7 @@ message TMHello {
optional bytes ledgerPrevious = 10; // the ledger before the last closed ledger optional bytes ledgerPrevious = 10; // the ledger before the last closed ledger
optional bool nodePrivate = 11; // Request to not forward IP. optional bool nodePrivate = 11; // Request to not forward IP.
optional TMProofWork proofOfWork = 12; // request/provide proof of work optional TMProofWork proofOfWork = 12; // request/provide proof of work
optional bool testNet = 13; // Running as testnet.
} }

View File

@@ -199,7 +199,8 @@ var Remote = function (opts, trace) {
this._ledger_current_index = undefined; this._ledger_current_index = undefined;
this._ledger_hash = undefined; this._ledger_hash = undefined;
this._ledger_time = undefined; this._ledger_time = undefined;
this.stand_alone = undefined; this._stand_alone = undefined;
this._testnet = undefined;
this.online_target = false; this.online_target = false;
this.online_state = 'closed'; // 'open', 'closed', 'connecting', 'closing' this.online_state = 'closed'; // 'open', 'closed', 'connecting', 'closing'
this.state = 'offline'; // 'online', 'offline' this.state = 'offline'; // 'online', 'offline'
@@ -859,7 +860,8 @@ Remote.prototype._server_subscribe = function () {
this.request_subscribe([ 'ledger', 'server' ]) this.request_subscribe([ 'ledger', 'server' ])
.on('success', function (message) { .on('success', function (message) {
self.stand_alone = !!message.stand_alone; self._stand_alone = !!message.stand_alone;
self._testnet = !!message.testnet;
if (message.random) if (message.random)
self.emit('random', utils.hexToArray(message.random)); self.emit('random', utils.hexToArray(message.random));
@@ -899,7 +901,7 @@ Remote.prototype._server_subscribe = function () {
// A good way to be notified of the result of this is: // A good way to be notified of the result of this is:
// remote.once('ledger_closed', function (ledger_closed, ledger_index) { ... } ); // remote.once('ledger_closed', function (ledger_closed, ledger_index) { ... } );
Remote.prototype.ledger_accept = function () { Remote.prototype.ledger_accept = function () {
if (this.stand_alone || undefined === this.stand_alone) if (this._stand_alone || undefined === this._stand_alone)
{ {
var request = new Request(this, 'ledger_accept'); var request = new Request(this, 'ledger_accept');

View File

@@ -37,7 +37,7 @@ exports.servers = {
exports.http_servers = { exports.http_servers = {
// A local test server // A local test server
"alpha-http" : { "zed" : {
"ip" : "127.0.0.1", "ip" : "127.0.0.1",
"port" : 8088, "port" : 8088,
} }