mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-25 13:35:54 +00:00
Merge branch 'master' of github.com:jedmccaleb/NewCoin
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -15,6 +15,7 @@
|
||||
# Ignore object files.
|
||||
*.o
|
||||
build
|
||||
tags
|
||||
|
||||
# Ignore locally installed node_modules
|
||||
node_modules
|
||||
|
||||
@@ -132,7 +132,7 @@ for file in RIPPLE_SRCS:
|
||||
|
||||
rippled = env.Program('build/rippled', RIPPLE_OBJS)
|
||||
|
||||
tags = env.CTags('build/obj/tags', RIPPLE_SRCS)
|
||||
tags = env.CTags('tags', RIPPLE_SRCS)
|
||||
|
||||
Default(rippled, tags)
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#
|
||||
# Sample rippled.cfg
|
||||
#
|
||||
# This file contains configuration information for rippled.
|
||||
#
|
||||
# This file should be named rippled.cfg. This file is UTF-8 with Dos, UNIX,
|
||||
# or Mac style end of lines. Blank lines and lines beginning with '#' are
|
||||
# ignored. Undefined sections are reserved. No escapes are currently defined.
|
||||
@@ -19,8 +21,7 @@
|
||||
#
|
||||
# Example: ripple.com
|
||||
#
|
||||
# [unl_default]:
|
||||
# XXX This should be called: [validators_file]
|
||||
# [validators_file]:
|
||||
# Specifies how to bootstrap the UNL list. The UNL list is based on a
|
||||
# validators.txt file and is maintained in the databases. When rippled
|
||||
# starts up, if the databases are missing or are obsolete due to an upgrade
|
||||
@@ -75,6 +76,11 @@
|
||||
# [peer_port]:
|
||||
# Port to bind to allow external connections from peers.
|
||||
#
|
||||
# [peer_private]:
|
||||
# 0 or 1.
|
||||
# 0: allow peers to broadcast your address. [default]
|
||||
# 1: request peers not broadcast your address.
|
||||
#
|
||||
# [rpc_ip]:
|
||||
# IP address or domain to bind to allow insecure RPC connections.
|
||||
# Defaults to not allow RPC connections.
|
||||
@@ -83,7 +89,8 @@
|
||||
# Port to bind to if allowing insecure RPC connections.
|
||||
#
|
||||
# [rpc_allow_remote]:
|
||||
# 0 or 1. 0 only allows RPC connections from 127.0.0.1. [default 0]
|
||||
# 0 or 1.
|
||||
# 0: only allows RPC connections from 127.0.0.1. [default]
|
||||
#
|
||||
# [websocket_ip]:
|
||||
# IP address or domain to bind to allow client connections.
|
||||
@@ -20,6 +20,7 @@
|
||||
#define SECTION_PEER_CONNECT_LOW_WATER "peer_connect_low_water"
|
||||
#define SECTION_PEER_IP "peer_ip"
|
||||
#define SECTION_PEER_PORT "peer_port"
|
||||
#define SECTION_PEER_PRIVATE "peer_private"
|
||||
#define SECTION_PEER_SCAN_INTERVAL_MIN "peer_scan_interval_min"
|
||||
#define SECTION_PEER_SSL_CIPHER_LIST "peer_ssl_cipher_list"
|
||||
#define SECTION_PEER_START_MAX "peer_start_max"
|
||||
@@ -27,7 +28,7 @@
|
||||
#define SECTION_RPC_IP "rpc_ip"
|
||||
#define SECTION_RPC_PORT "rpc_port"
|
||||
#define SECTION_SNTP "sntp_servers"
|
||||
#define SECTION_UNL_DEFAULT "unl_default"
|
||||
#define SECTION_VALIDATORS_FILE "validators_file"
|
||||
#define SECTION_VALIDATION_QUORUM "validation_quorum"
|
||||
#define SECTION_VALIDATION_SEED "validation_seed"
|
||||
#define SECTION_WEBSOCKET_PUBLIC_IP "websocket_public_ip"
|
||||
@@ -143,6 +144,8 @@ void Config::setup(const std::string& strConf)
|
||||
PEER_START_MAX = DEFAULT_PEER_START_MAX;
|
||||
PEER_CONNECT_LOW_WATER = DEFAULT_PEER_CONNECT_LOW_WATER;
|
||||
|
||||
PEER_PRIVATE = false;
|
||||
|
||||
TRANSACTION_FEE_BASE = 1000;
|
||||
|
||||
NETWORK_QUORUM = 0; // Don't need to see other nodes
|
||||
@@ -222,6 +225,9 @@ void Config::load()
|
||||
if (sectionSingleB(secConfig, SECTION_PEER_PORT, strTemp))
|
||||
PEER_PORT = boost::lexical_cast<int>(strTemp);
|
||||
|
||||
if (sectionSingleB(secConfig, SECTION_PEER_PRIVATE, strTemp))
|
||||
PEER_PRIVATE = boost::lexical_cast<bool>(strTemp);
|
||||
|
||||
(void) sectionSingleB(secConfig, SECTION_RPC_IP, RPC_IP);
|
||||
|
||||
if (sectionSingleB(secConfig, SECTION_RPC_PORT, strTemp))
|
||||
@@ -292,8 +298,8 @@ void Config::load()
|
||||
if (sectionSingleB(secConfig, SECTION_ACCOUNT_PROBE_MAX, strTemp))
|
||||
ACCOUNT_PROBE_MAX = boost::lexical_cast<int>(strTemp);
|
||||
|
||||
if (sectionSingleB(secConfig, SECTION_UNL_DEFAULT, strTemp))
|
||||
UNL_DEFAULT = strTemp;
|
||||
if (sectionSingleB(secConfig, SECTION_VALIDATORS_FILE, strTemp))
|
||||
VALIDATORS_FILE = strTemp;
|
||||
|
||||
if (sectionSingleB(secConfig, SECTION_DEBUG_LOGFILE, strTemp))
|
||||
DEBUG_LOGFILE = strTemp;
|
||||
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
boost::filesystem::path CONFIG_DIR;
|
||||
boost::filesystem::path DATA_DIR;
|
||||
boost::filesystem::path DEBUG_LOGFILE;
|
||||
boost::filesystem::path UNL_DEFAULT;
|
||||
boost::filesystem::path VALIDATORS_FILE;
|
||||
|
||||
std::string VALIDATORS_SITE; // Where to find validators.txt on the Internet.
|
||||
std::vector<std::string> VALIDATORS; // Validators from rippled.cfg.
|
||||
@@ -66,7 +66,7 @@ public:
|
||||
int LEDGER_SECONDS;
|
||||
int LEDGER_PROPOSAL_DELAY_SECONDS;
|
||||
int LEDGER_AVALANCHE_SECONDS;
|
||||
bool LEDGER_CREATOR; // should be false unless we are starting a new ledger
|
||||
bool LEDGER_CREATOR; // Should be false unless we are starting a new ledger.
|
||||
bool RUN_STANDALONE;
|
||||
|
||||
// Note: The following parameters do not relate to the UNL or trust at all
|
||||
@@ -81,6 +81,7 @@ public:
|
||||
int PEER_SCAN_INTERVAL_MIN;
|
||||
int PEER_START_MAX;
|
||||
unsigned int PEER_CONNECT_LOW_WATER;
|
||||
bool PEER_PRIVATE; // True to ask peers not to relay current IP.
|
||||
|
||||
// Websocket networking parameters
|
||||
std::string WEBSOCKET_PUBLIC_IP; // XXX Going away. Merge with the inbound peer connction.
|
||||
|
||||
@@ -300,6 +300,7 @@ void ConnectionPool::connectTo(const std::string& strIp, int iPort)
|
||||
{
|
||||
if (theConfig.RUN_STANDALONE)
|
||||
return;
|
||||
|
||||
{
|
||||
Database* db = theApp->getWalletDB()->getDB();
|
||||
ScopedLock sl(theApp->getWalletDB()->getDBLock());
|
||||
|
||||
@@ -430,24 +430,29 @@ void Peer::processReadBuffer()
|
||||
case ripple::mtCONTACT:
|
||||
{
|
||||
ripple::TMContact msg;
|
||||
|
||||
if (msg.ParseFromArray(&mReadbuf[HEADER_SIZE], mReadbuf.size() - HEADER_SIZE))
|
||||
recvContact(msg);
|
||||
else
|
||||
cLog(lsWARNING) << "parse error: " << type;
|
||||
}
|
||||
break;
|
||||
|
||||
case ripple::mtGET_PEERS:
|
||||
{
|
||||
ripple::TMGetPeers msg;
|
||||
|
||||
if (msg.ParseFromArray(&mReadbuf[HEADER_SIZE], mReadbuf.size() - HEADER_SIZE))
|
||||
recvGetPeers(msg);
|
||||
else
|
||||
cLog(lsWARNING) << "parse error: " << type;
|
||||
}
|
||||
break;
|
||||
|
||||
case ripple::mtPEERS:
|
||||
{
|
||||
ripple::TMPeers msg;
|
||||
|
||||
if (msg.ParseFromArray(&mReadbuf[HEADER_SIZE], mReadbuf.size() - HEADER_SIZE))
|
||||
recvPeers(msg);
|
||||
else
|
||||
@@ -666,8 +671,18 @@ void Peer::recvHello(ripple::TMHello& packet)
|
||||
std::string strIP = getSocket().remote_endpoint().address().to_string();
|
||||
int iPort = packet.ipv4port();
|
||||
|
||||
if (mHello.nodeprivate())
|
||||
{
|
||||
cLog(lsINFO) << boost::str(boost::format("Recv(Hello): Private connection: %s %s") % strIP % iPort);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Don't save IP address if the node wants privacy.
|
||||
// Note: We don't go so far as to delete it. If a node which has previously announced itself now wants
|
||||
// privacy, it should at least change its port.
|
||||
theApp->getConnectionPool().savePeer(strIP, iPort, UniqueNodeList::vsInbound);
|
||||
}
|
||||
}
|
||||
|
||||
// Consider us connected. No longer accepting mtHELLO.
|
||||
mHelloed = true;
|
||||
@@ -994,7 +1009,7 @@ void Peer::recvGetContacts(ripple::TMGetContacts& packet)
|
||||
{
|
||||
}
|
||||
|
||||
// return a list of your favorite people
|
||||
// Return a list of your favorite people
|
||||
// TODO: filter out all the LAN peers
|
||||
// TODO: filter out the peer you are talking to
|
||||
void Peer::recvGetPeers(ripple::TMGetPeers& packet)
|
||||
@@ -1510,6 +1525,7 @@ void Peer::sendHello()
|
||||
h.set_nodepublic(theApp->getWallet().getNodePublic().humanNodePublic());
|
||||
h.set_nodeproof(&vchSig[0], vchSig.size());
|
||||
h.set_ipv4port(theConfig.PEER_PORT);
|
||||
h.set_nodeprivate(theConfig.PEER_PRIVATE);
|
||||
|
||||
Ledger::pointer closedLedger = theApp->getMasterLedger().getClosedLedger();
|
||||
if (closedLedger && closedLedger->isClosed())
|
||||
@@ -1526,7 +1542,7 @@ void Peer::sendHello()
|
||||
|
||||
void Peer::sendGetPeers()
|
||||
{
|
||||
// get other peers this guy knows about
|
||||
// Ask peer for known other peers.
|
||||
ripple::TMGetPeers getPeers;
|
||||
|
||||
getPeers.set_doweneedthis(1);
|
||||
|
||||
@@ -49,6 +49,7 @@ private:
|
||||
ipPort mIpPortConnect;
|
||||
uint256 mCookieHash;
|
||||
uint64 mPeerId;
|
||||
bool mPrivate; // Keep peer IP private.
|
||||
|
||||
uint256 mClosedLedgerHash, mPreviousLedgerHash;
|
||||
std::list<uint256> mRecentLedgers;
|
||||
|
||||
@@ -1640,7 +1640,7 @@ Json::Value RPCHandler::doUnlList(const Json::Value& params)
|
||||
// Populate the UNL from a local validators.txt file.
|
||||
Json::Value RPCHandler::doUnlLoad(const Json::Value& params)
|
||||
{
|
||||
if (theConfig.UNL_DEFAULT.empty() || !theApp->getUNL().nodeLoad(theConfig.UNL_DEFAULT))
|
||||
if (theConfig.VALIDATORS_FILE.empty() || !theApp->getUNL().nodeLoad(theConfig.VALIDATORS_FILE))
|
||||
{
|
||||
return rpcError(rpcLOAD_FAILED);
|
||||
}
|
||||
|
||||
@@ -35,14 +35,11 @@ Transactor::pointer Transactor::makeTransactor(const SerializedTransaction& txn,
|
||||
}
|
||||
|
||||
|
||||
Transactor::Transactor(const SerializedTransaction& txn,TransactionEngineParams params, TransactionEngine* engine) : mTxn(txn), mParams(params), mEngine(engine)
|
||||
Transactor::Transactor(const SerializedTransaction& txn,TransactionEngineParams params, TransactionEngine* engine) : mTxn(txn), mEngine(engine), mParams(params)
|
||||
{
|
||||
mHasAuthKey=false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void Transactor::calculateFee()
|
||||
{
|
||||
mFeeDue = theConfig.FEE_DEFAULT;
|
||||
@@ -78,7 +75,6 @@ TER Transactor::payFee()
|
||||
mTxnAccount->setFieldAmount(sfBalance, mSourceBalance);
|
||||
|
||||
return tesSUCCESS;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -137,7 +133,6 @@ TER Transactor::checkSeq()
|
||||
cLog(lsWARNING) << "applyTransaction: past sequence number";
|
||||
|
||||
return tefPAST_SEQ;
|
||||
|
||||
}else
|
||||
{
|
||||
mTxnAccount->setFieldU32(sfSequence, t_seq + 1);
|
||||
@@ -216,5 +211,6 @@ TER Transactor::apply()
|
||||
mEngine->entryModify(mTxnAccount);
|
||||
|
||||
return doApply();
|
||||
|
||||
}
|
||||
|
||||
// vim:ts=4
|
||||
|
||||
@@ -1576,15 +1576,15 @@ void UniqueNodeList::nodeBootstrap()
|
||||
bool bLoaded = iDomains || iNodes;
|
||||
|
||||
// Always merge in the file specified in the config.
|
||||
if (!theConfig.UNL_DEFAULT.empty())
|
||||
if (!theConfig.VALIDATORS_FILE.empty())
|
||||
{
|
||||
cLog(lsINFO) << "Bootstrapping UNL: loading from unl_default.";
|
||||
|
||||
bLoaded = nodeLoad(theConfig.UNL_DEFAULT);
|
||||
bLoaded = nodeLoad(theConfig.VALIDATORS_FILE);
|
||||
}
|
||||
|
||||
// If never loaded anything try the current directory.
|
||||
if (!bLoaded && theConfig.UNL_DEFAULT.empty())
|
||||
if (!bLoaded && theConfig.VALIDATORS_FILE.empty())
|
||||
{
|
||||
cLog(lsINFO) << "Bootstrapping UNL: loading from '" VALIDATORS_FILE_NAME "'.";
|
||||
|
||||
|
||||
@@ -34,7 +34,6 @@ enum MessageType {
|
||||
|
||||
// Sent on connect
|
||||
|
||||
|
||||
message TMHello {
|
||||
required uint32 protoVersion = 1;
|
||||
required uint32 protoVersionMin = 2;
|
||||
@@ -46,6 +45,7 @@ message TMHello {
|
||||
optional uint32 ledgerIndex = 8;
|
||||
optional bytes ledgerClosed = 9; // our last closed ledger
|
||||
optional bytes ledgerPrevious = 10; // the ledger before the last closed ledger
|
||||
optional bool nodePrivate = 11; // Request to not forward IP.
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user