mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-26 14:05:51 +00:00
Remove unused macros, config variables, and file
This commit is contained in:
committed by
Vinnie Falco
parent
4239880acb
commit
f65cea66ef
@@ -3183,11 +3183,6 @@
|
|||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClInclude Include="..\..\src\ripple\rpc\impl\Accounts.h">
|
<ClInclude Include="..\..\src\ripple\rpc\impl\Accounts.h">
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClCompile Include="..\..\src\ripple\rpc\impl\Authorize.cpp">
|
|
||||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
|
||||||
</ClCompile>
|
|
||||||
<ClInclude Include="..\..\src\ripple\rpc\impl\Authorize.h">
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\src\ripple\rpc\impl\Context.h">
|
<ClInclude Include="..\..\src\ripple\rpc\impl\Context.h">
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\ripple\rpc\impl\DoPrint.h">
|
<ClInclude Include="..\..\src\ripple\rpc\impl\DoPrint.h">
|
||||||
|
|||||||
@@ -4377,12 +4377,6 @@
|
|||||||
<ClInclude Include="..\..\src\ripple\rpc\impl\Accounts.h">
|
<ClInclude Include="..\..\src\ripple\rpc\impl\Accounts.h">
|
||||||
<Filter>ripple\rpc\impl</Filter>
|
<Filter>ripple\rpc\impl</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClCompile Include="..\..\src\ripple\rpc\impl\Authorize.cpp">
|
|
||||||
<Filter>ripple\rpc\impl</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClInclude Include="..\..\src\ripple\rpc\impl\Authorize.h">
|
|
||||||
<Filter>ripple\rpc\impl</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\src\ripple\rpc\impl\Context.h">
|
<ClInclude Include="..\..\src\ripple\rpc\impl\Context.h">
|
||||||
<Filter>ripple\rpc\impl</Filter>
|
<Filter>ripple\rpc\impl</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
|||||||
@@ -24,6 +24,9 @@ namespace ripple {
|
|||||||
class SetAccount
|
class SetAccount
|
||||||
: public Transactor
|
: public Transactor
|
||||||
{
|
{
|
||||||
|
static int const DOMAIN_BYTES_MAX = 256;
|
||||||
|
static int const PUBLIC_BYTES_MAX = 33;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SetAccount (
|
SetAccount (
|
||||||
SerializedTransaction const& txn,
|
SerializedTransaction const& txn,
|
||||||
|
|||||||
@@ -163,30 +163,7 @@ get (Section const& section,
|
|||||||
#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)
|
||||||
|
|
||||||
const int DOMAIN_BYTES_MAX = 256;
|
const int SYSTEM_PEER_PORT = 6561;
|
||||||
const int PUBLIC_BYTES_MAX = 33; // Maximum bytes for an account public key.
|
|
||||||
|
|
||||||
const int SYSTEM_PEER_PORT = 6561;
|
|
||||||
const int SYSTEM_WEBSOCKET_PORT = 6562;
|
|
||||||
const int SYSTEM_WEBSOCKET_PUBLIC_PORT = 6563; // XXX Going away.
|
|
||||||
|
|
||||||
// Allow anonymous DH.
|
|
||||||
#define DEFAULT_PEER_SSL_CIPHER_LIST "ALL:!LOW:!EXP:!MD5:@STRENGTH"
|
|
||||||
|
|
||||||
// Normal, recommend 1 hour: 60*60
|
|
||||||
// Testing, recommend 1 minute: 60
|
|
||||||
#define DEFAULT_PEER_SCAN_INTERVAL_MIN (60*60) // Seconds
|
|
||||||
|
|
||||||
// Maximum number of peers to try to connect to as client at once.
|
|
||||||
#define DEFAULT_PEER_START_MAX 5
|
|
||||||
|
|
||||||
// Might connect with fewer for testing.
|
|
||||||
#define DEFAULT_PEER_CONNECT_LOW_WATER 10
|
|
||||||
|
|
||||||
#define DEFAULT_PATH_SEARCH_OLD 7
|
|
||||||
#define DEFAULT_PATH_SEARCH 7
|
|
||||||
#define DEFAULT_PATH_SEARCH_FAST 2
|
|
||||||
#define DEFAULT_PATH_SEARCH_MAX 10
|
|
||||||
|
|
||||||
enum SizedItemName
|
enum SizedItemName
|
||||||
{
|
{
|
||||||
@@ -221,8 +198,6 @@ struct SizedItem
|
|||||||
class Config : public BasicConfig
|
class Config : public BasicConfig
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
||||||
struct Helpers
|
struct Helpers
|
||||||
{
|
{
|
||||||
// This replaces CONFIG_FILE_NAME
|
// This replaces CONFIG_FILE_NAME
|
||||||
@@ -242,65 +217,6 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/** The result of performing a load on the parsed config file data.
|
|
||||||
This type is convertible to `bool`.
|
|
||||||
A value of `true` indicates an error occurred,
|
|
||||||
while `false` indicates no error.
|
|
||||||
*/
|
|
||||||
class Error
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
Error () noexcept
|
|
||||||
: m_what (beast::String::empty)
|
|
||||||
, m_fileName ("")
|
|
||||||
, m_lineNumber (0)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
Error (beast::String what, char const* fileName, int lineNumber) noexcept
|
|
||||||
: m_what (what)
|
|
||||||
, m_fileName (fileName)
|
|
||||||
, m_lineNumber (lineNumber)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
explicit
|
|
||||||
operator bool() const noexcept
|
|
||||||
{
|
|
||||||
return m_what != beast::String::empty;
|
|
||||||
}
|
|
||||||
|
|
||||||
beast::String what () const noexcept
|
|
||||||
{
|
|
||||||
return m_what;
|
|
||||||
}
|
|
||||||
|
|
||||||
char const* fileName () const
|
|
||||||
{
|
|
||||||
return m_fileName;
|
|
||||||
}
|
|
||||||
|
|
||||||
int lineNumber () const
|
|
||||||
{
|
|
||||||
return m_lineNumber;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
beast::String m_what;
|
|
||||||
char const* m_fileName;
|
|
||||||
int m_lineNumber;
|
|
||||||
};
|
|
||||||
|
|
||||||
/** Listening socket settings. */
|
|
||||||
struct DoorSettings
|
|
||||||
{
|
|
||||||
/** Create a default set of door (listening socket) settings. */
|
|
||||||
DoorSettings ();
|
|
||||||
|
|
||||||
/** Load settings from the configuration file. */
|
|
||||||
//Error load (ParsedConfigFile const& file);
|
|
||||||
};
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
|
|
||||||
// Settings related to the configuration file location and directories
|
// Settings related to the configuration file location and directories
|
||||||
@@ -499,10 +415,7 @@ public:
|
|||||||
std::string DATABASE_PATH;
|
std::string DATABASE_PATH;
|
||||||
|
|
||||||
// Network parameters
|
// Network parameters
|
||||||
int NETWORK_START_TIME; // The Unix time we start ledger 0.
|
|
||||||
int TRANSACTION_FEE_BASE; // The number of fee units a reference transaction costs
|
int TRANSACTION_FEE_BASE; // The number of fee units a reference transaction costs
|
||||||
int LEDGER_SECONDS;
|
|
||||||
bool LEDGER_CREATOR; // Should be false unless we are starting a new ledger.
|
|
||||||
|
|
||||||
/** Operate in stand-alone mode.
|
/** Operate in stand-alone mode.
|
||||||
|
|
||||||
@@ -521,11 +434,7 @@ public:
|
|||||||
|
|
||||||
// Peer networking parameters
|
// Peer networking parameters
|
||||||
std::string PEER_IP;
|
std::string PEER_IP;
|
||||||
int NUMBER_CONNECTIONS;
|
|
||||||
std::string PEER_SSL_CIPHER_LIST;
|
std::string PEER_SSL_CIPHER_LIST;
|
||||||
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.
|
bool PEER_PRIVATE; // True to ask peers not to relay current IP.
|
||||||
unsigned int PEERS_MAX;
|
unsigned int PEERS_MAX;
|
||||||
|
|
||||||
@@ -569,18 +478,22 @@ public:
|
|||||||
int PATH_SEARCH_MAX;
|
int PATH_SEARCH_MAX;
|
||||||
|
|
||||||
// Validation
|
// Validation
|
||||||
RippleAddress VALIDATION_SEED, VALIDATION_PUB, VALIDATION_PRIV;
|
RippleAddress VALIDATION_SEED;
|
||||||
|
RippleAddress VALIDATION_PUB;
|
||||||
|
RippleAddress VALIDATION_PRIV;
|
||||||
|
|
||||||
// Node/Cluster
|
// Node/Cluster
|
||||||
std::vector<std::string> CLUSTER_NODES;
|
std::vector<std::string> CLUSTER_NODES;
|
||||||
RippleAddress NODE_SEED, NODE_PUB, NODE_PRIV;
|
RippleAddress NODE_SEED;
|
||||||
|
RippleAddress NODE_PUB;
|
||||||
|
RippleAddress NODE_PRIV;
|
||||||
|
|
||||||
// Fee schedule (All below values are in fee units)
|
// Fee schedule (All below values are in fee units)
|
||||||
std::uint64_t FEE_DEFAULT; // Default fee.
|
std::uint64_t FEE_DEFAULT; // Default fee.
|
||||||
std::uint64_t FEE_ACCOUNT_RESERVE; // Amount of units not allowed to send.
|
std::uint64_t FEE_ACCOUNT_RESERVE; // Amount of units not allowed to send.
|
||||||
std::uint64_t FEE_OWNER_RESERVE; // Amount of units not allowed to send per owner entry.
|
std::uint64_t FEE_OWNER_RESERVE; // Amount of units not allowed to send per owner entry.
|
||||||
std::uint64_t FEE_OFFER; // Rate per day.
|
std::uint64_t FEE_OFFER; // Rate per day.
|
||||||
int FEE_CONTRACT_OPERATION; // fee for each contract operation
|
int FEE_CONTRACT_OPERATION; // fee for each contract operation
|
||||||
|
|
||||||
// Node storage configuration
|
// Node storage configuration
|
||||||
std::uint32_t LEDGER_HISTORY;
|
std::uint32_t LEDGER_HISTORY;
|
||||||
|
|||||||
@@ -58,15 +58,12 @@ struct ConfigSection
|
|||||||
#define SECTION_PATH_SEARCH "path_search"
|
#define SECTION_PATH_SEARCH "path_search"
|
||||||
#define SECTION_PATH_SEARCH_FAST "path_search_fast"
|
#define SECTION_PATH_SEARCH_FAST "path_search_fast"
|
||||||
#define SECTION_PATH_SEARCH_MAX "path_search_max"
|
#define SECTION_PATH_SEARCH_MAX "path_search_max"
|
||||||
#define SECTION_PEER_CONNECT_LOW_WATER "peer_connect_low_water"
|
|
||||||
#define SECTION_PEER_IP "peer_ip"
|
#define SECTION_PEER_IP "peer_ip"
|
||||||
#define SECTION_PEER_PORT "peer_port"
|
#define SECTION_PEER_PORT "peer_port"
|
||||||
#define SECTION_PEER_PROXY_PORT "peer_port_proxy"
|
#define SECTION_PEER_PROXY_PORT "peer_port_proxy"
|
||||||
#define SECTION_PEER_PRIVATE "peer_private"
|
#define SECTION_PEER_PRIVATE "peer_private"
|
||||||
#define SECTION_PEERS_MAX "peers_max"
|
#define SECTION_PEERS_MAX "peers_max"
|
||||||
#define SECTION_PEER_SCAN_INTERVAL_MIN "peer_scan_interval_min"
|
|
||||||
#define SECTION_PEER_SSL_CIPHER_LIST "peer_ssl_cipher_list"
|
#define SECTION_PEER_SSL_CIPHER_LIST "peer_ssl_cipher_list"
|
||||||
#define SECTION_PEER_START_MAX "peer_start_max"
|
|
||||||
#define SECTION_RPC_ALLOW_REMOTE "rpc_allow_remote"
|
#define SECTION_RPC_ALLOW_REMOTE "rpc_allow_remote"
|
||||||
#define SECTION_RPC_ADMIN_ALLOW "rpc_admin_allow"
|
#define SECTION_RPC_ADMIN_ALLOW "rpc_admin_allow"
|
||||||
#define SECTION_RPC_ADMIN_USER "rpc_admin_user"
|
#define SECTION_RPC_ADMIN_USER "rpc_admin_user"
|
||||||
@@ -95,9 +92,9 @@ struct ConfigSection
|
|||||||
#define SECTION_WEBSOCKET_PUBLIC_IP "websocket_public_ip"
|
#define SECTION_WEBSOCKET_PUBLIC_IP "websocket_public_ip"
|
||||||
#define SECTION_WEBSOCKET_PUBLIC_PORT "websocket_public_port"
|
#define SECTION_WEBSOCKET_PUBLIC_PORT "websocket_public_port"
|
||||||
#define SECTION_WEBSOCKET_PUBLIC_SECURE "websocket_public_secure"
|
#define SECTION_WEBSOCKET_PUBLIC_SECURE "websocket_public_secure"
|
||||||
#define SECTION_WEBSOCKET_PROXY_IP "websocket_proxy_ip"
|
#define SECTION_WEBSOCKET_PROXY_IP "websocket_proxy_ip"
|
||||||
#define SECTION_WEBSOCKET_PROXY_PORT "websocket_proxy_port"
|
#define SECTION_WEBSOCKET_PROXY_PORT "websocket_proxy_port"
|
||||||
#define SECTION_WEBSOCKET_PROXY_SECURE "websocket_proxy_secure"
|
#define SECTION_WEBSOCKET_PROXY_SECURE "websocket_proxy_secure"
|
||||||
#define SECTION_WEBSOCKET_PING_FREQ "websocket_ping_frequency"
|
#define SECTION_WEBSOCKET_PING_FREQ "websocket_ping_frequency"
|
||||||
#define SECTION_WEBSOCKET_IP "websocket_ip"
|
#define SECTION_WEBSOCKET_IP "websocket_ip"
|
||||||
#define SECTION_WEBSOCKET_PORT "websocket_port"
|
#define SECTION_WEBSOCKET_PORT "websocket_port"
|
||||||
|
|||||||
@@ -332,30 +332,20 @@ Config::Config ()
|
|||||||
// Defaults
|
// Defaults
|
||||||
//
|
//
|
||||||
|
|
||||||
NETWORK_START_TIME = 1319844908;
|
|
||||||
|
|
||||||
RPC_SECURE = 0;
|
RPC_SECURE = 0;
|
||||||
WEBSOCKET_PORT = SYSTEM_WEBSOCKET_PORT;
|
WEBSOCKET_PORT = 6562;
|
||||||
WEBSOCKET_PUBLIC_PORT = SYSTEM_WEBSOCKET_PUBLIC_PORT;
|
WEBSOCKET_PUBLIC_PORT = 6563;
|
||||||
WEBSOCKET_PUBLIC_SECURE = 1;
|
WEBSOCKET_PUBLIC_SECURE = 1;
|
||||||
WEBSOCKET_PROXY_PORT = 0;
|
WEBSOCKET_PROXY_PORT = 0;
|
||||||
WEBSOCKET_PROXY_SECURE = 1;
|
WEBSOCKET_PROXY_SECURE = 1;
|
||||||
WEBSOCKET_SECURE = 0;
|
WEBSOCKET_SECURE = 0;
|
||||||
WEBSOCKET_PING_FREQ = (5 * 60);
|
WEBSOCKET_PING_FREQ = (5 * 60);
|
||||||
NUMBER_CONNECTIONS = 30;
|
|
||||||
|
|
||||||
// a new ledger every minute
|
|
||||||
LEDGER_SECONDS = 60;
|
|
||||||
LEDGER_CREATOR = false;
|
|
||||||
|
|
||||||
RPC_ALLOW_REMOTE = false;
|
RPC_ALLOW_REMOTE = false;
|
||||||
RPC_ADMIN_ALLOW.push_back (beast::IP::Endpoint::from_string("127.0.0.1"));
|
RPC_ADMIN_ALLOW.push_back (beast::IP::Endpoint::from_string("127.0.0.1"));
|
||||||
|
|
||||||
PEER_SSL_CIPHER_LIST = DEFAULT_PEER_SSL_CIPHER_LIST;
|
// By default, allow anonymous DH.
|
||||||
PEER_SCAN_INTERVAL_MIN = DEFAULT_PEER_SCAN_INTERVAL_MIN;
|
PEER_SSL_CIPHER_LIST = "ALL:!LOW:!EXP:!MD5:@STRENGTH";
|
||||||
|
|
||||||
PEER_START_MAX = DEFAULT_PEER_START_MAX;
|
|
||||||
PEER_CONNECT_LOW_WATER = DEFAULT_PEER_CONNECT_LOW_WATER;
|
|
||||||
|
|
||||||
PEER_PRIVATE = false;
|
PEER_PRIVATE = false;
|
||||||
PEERS_MAX = 0; // indicates "use default"
|
PEERS_MAX = 0; // indicates "use default"
|
||||||
@@ -374,10 +364,11 @@ Config::Config ()
|
|||||||
LEDGER_HISTORY = 256;
|
LEDGER_HISTORY = 256;
|
||||||
FETCH_DEPTH = 1000000000;
|
FETCH_DEPTH = 1000000000;
|
||||||
|
|
||||||
PATH_SEARCH_OLD = DEFAULT_PATH_SEARCH_OLD;
|
// An explanation of these magical values would be nice.
|
||||||
PATH_SEARCH = DEFAULT_PATH_SEARCH;
|
PATH_SEARCH_OLD = 7;
|
||||||
PATH_SEARCH_FAST = DEFAULT_PATH_SEARCH_FAST;
|
PATH_SEARCH = 7;
|
||||||
PATH_SEARCH_MAX = DEFAULT_PATH_SEARCH_MAX;
|
PATH_SEARCH_FAST = 2;
|
||||||
|
PATH_SEARCH_MAX = 10;
|
||||||
|
|
||||||
ACCOUNT_PROBE_MAX = 10;
|
ACCOUNT_PROBE_MAX = 10;
|
||||||
|
|
||||||
@@ -652,9 +643,6 @@ void Config::load ()
|
|||||||
if (getSingleSection (secConfig, SECTION_RPC_PORT, strTemp))
|
if (getSingleSection (secConfig, SECTION_RPC_PORT, strTemp))
|
||||||
m_rpcPort = beast::lexicalCastThrow <int> (strTemp);
|
m_rpcPort = beast::lexicalCastThrow <int> (strTemp);
|
||||||
|
|
||||||
if (getSingleSection (secConfig, "ledger_creator" , strTemp))
|
|
||||||
LEDGER_CREATOR = beast::lexicalCastThrow <bool> (strTemp);
|
|
||||||
|
|
||||||
if (getSingleSection (secConfig, SECTION_RPC_ALLOW_REMOTE, strTemp))
|
if (getSingleSection (secConfig, SECTION_RPC_ALLOW_REMOTE, strTemp))
|
||||||
RPC_ALLOW_REMOTE = beast::lexicalCastThrow <bool> (strTemp);
|
RPC_ALLOW_REMOTE = beast::lexicalCastThrow <bool> (strTemp);
|
||||||
|
|
||||||
@@ -753,16 +741,6 @@ void Config::load ()
|
|||||||
|
|
||||||
(void) getSingleSection (secConfig, SECTION_PEER_SSL_CIPHER_LIST, PEER_SSL_CIPHER_LIST);
|
(void) getSingleSection (secConfig, SECTION_PEER_SSL_CIPHER_LIST, PEER_SSL_CIPHER_LIST);
|
||||||
|
|
||||||
if (getSingleSection (secConfig, SECTION_PEER_SCAN_INTERVAL_MIN, strTemp))
|
|
||||||
// Minimum for min is 60 seconds.
|
|
||||||
PEER_SCAN_INTERVAL_MIN = std::max (60, beast::lexicalCastThrow <int> (strTemp));
|
|
||||||
|
|
||||||
if (getSingleSection (secConfig, SECTION_PEER_START_MAX, strTemp))
|
|
||||||
PEER_START_MAX = std::max (1, beast::lexicalCastThrow <int> (strTemp));
|
|
||||||
|
|
||||||
if (getSingleSection (secConfig, SECTION_PEER_CONNECT_LOW_WATER, strTemp))
|
|
||||||
PEER_CONNECT_LOW_WATER = std::max (1, beast::lexicalCastThrow <int> (strTemp));
|
|
||||||
|
|
||||||
if (getSingleSection (secConfig, SECTION_NETWORK_QUORUM, strTemp))
|
if (getSingleSection (secConfig, SECTION_NETWORK_QUORUM, strTemp))
|
||||||
NETWORK_QUORUM = beast::lexicalCastThrow <std::size_t> (strTemp);
|
NETWORK_QUORUM = beast::lexicalCastThrow <std::size_t> (strTemp);
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,6 @@
|
|||||||
|
|
||||||
#include <ripple/rpc/impl/AccountFromString.h>
|
#include <ripple/rpc/impl/AccountFromString.h>
|
||||||
#include <ripple/rpc/impl/Accounts.h>
|
#include <ripple/rpc/impl/Accounts.h>
|
||||||
#include <ripple/rpc/impl/Authorize.h>
|
|
||||||
#include <ripple/rpc/impl/Context.h>
|
#include <ripple/rpc/impl/Context.h>
|
||||||
#include <ripple/rpc/impl/GetMasterGenerator.h>
|
#include <ripple/rpc/impl/GetMasterGenerator.h>
|
||||||
#include <ripple/rpc/impl/LookupLedger.h>
|
#include <ripple/rpc/impl/LookupLedger.h>
|
||||||
|
|||||||
@@ -1,121 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
/*
|
|
||||||
This file is part of rippled: https://github.com/ripple/rippled
|
|
||||||
Copyright (c) 2012-2014 Ripple Labs Inc.
|
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
|
||||||
copyright notice and this permission notice appear in all copies.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
||||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
||||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
//==============================================================================
|
|
||||||
|
|
||||||
#include <ripple/rpc/impl/Authorize.h>
|
|
||||||
|
|
||||||
namespace ripple {
|
|
||||||
namespace RPC {
|
|
||||||
|
|
||||||
// Given a seed and a source account get the regular public and private key for authorizing transactions.
|
|
||||||
// - Make sure the source account can pay.
|
|
||||||
// --> naRegularSeed : To find the generator
|
|
||||||
// --> naSrcAccountID : Account we want the public and private regular keys to.
|
|
||||||
// <-- naAccountPublic : Regular public key for naSrcAccountID
|
|
||||||
// <-- naAccountPrivate : Regular private key for naSrcAccountID
|
|
||||||
// <-- saSrcBalance: Balance minus fee.
|
|
||||||
// --> naVerifyGenerator : If provided, the found master public generator must match.
|
|
||||||
// XXX Be more lenient, allow use of master generator on claimed accounts.
|
|
||||||
Json::Value authorize (Ledger::ref lrLedger,
|
|
||||||
RippleAddress const& naRegularSeed, RippleAddress const& naSrcAccountID,
|
|
||||||
RippleAddress& naAccountPublic, RippleAddress& naAccountPrivate,
|
|
||||||
STAmount& saSrcBalance, STAmount const& saFee, AccountState::pointer& asSrc,
|
|
||||||
RippleAddress const& naVerifyGenerator, NetworkOPs& netOps)
|
|
||||||
{
|
|
||||||
// Source/paying account must exist.
|
|
||||||
asSrc = netOps.getAccountState (lrLedger, naSrcAccountID);
|
|
||||||
|
|
||||||
if (!asSrc)
|
|
||||||
{
|
|
||||||
return rpcError (rpcSRC_ACT_NOT_FOUND);
|
|
||||||
}
|
|
||||||
|
|
||||||
RippleAddress naMasterGenerator;
|
|
||||||
|
|
||||||
if (asSrc->haveAuthorizedKey ())
|
|
||||||
{
|
|
||||||
Json::Value obj = getMasterGenerator (lrLedger, naRegularSeed, naMasterGenerator, netOps);
|
|
||||||
|
|
||||||
if (!obj.empty ())
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Try the seed as a master seed.
|
|
||||||
naMasterGenerator = RippleAddress::createGeneratorPublic (naRegularSeed);
|
|
||||||
}
|
|
||||||
|
|
||||||
// If naVerifyGenerator is provided, make sure it is the master generator.
|
|
||||||
if (naVerifyGenerator.isValid () && naMasterGenerator != naVerifyGenerator)
|
|
||||||
{
|
|
||||||
return rpcError (rpcWRONG_SEED);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Find the index of the account from the master generator, so we can generate the public and private keys.
|
|
||||||
RippleAddress naMasterAccountPublic;
|
|
||||||
unsigned int iIndex = 0;
|
|
||||||
bool bFound = false;
|
|
||||||
|
|
||||||
// Don't look at ledger entries to determine if the account exists. Don't want to leak to thin server that these accounts are
|
|
||||||
// related.
|
|
||||||
while (!bFound && iIndex != getConfig ().ACCOUNT_PROBE_MAX)
|
|
||||||
{
|
|
||||||
naMasterAccountPublic.setAccountPublic (naMasterGenerator, iIndex);
|
|
||||||
|
|
||||||
WriteLog (lsDEBUG, RPCHandler) << "authorize: " << iIndex << " : " << naMasterAccountPublic.humanAccountID () << " : " << naSrcAccountID.humanAccountID ();
|
|
||||||
|
|
||||||
bFound = naSrcAccountID.getAccountID () == naMasterAccountPublic.getAccountID ();
|
|
||||||
|
|
||||||
if (!bFound)
|
|
||||||
++iIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!bFound)
|
|
||||||
{
|
|
||||||
return rpcError (rpcACT_NOT_FOUND);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Use the regular generator to determine the associated public and private keys.
|
|
||||||
RippleAddress naGenerator = RippleAddress::createGeneratorPublic (naRegularSeed);
|
|
||||||
|
|
||||||
naAccountPublic.setAccountPublic (naGenerator, iIndex);
|
|
||||||
naAccountPrivate.setAccountPrivate (naGenerator, naRegularSeed, iIndex);
|
|
||||||
|
|
||||||
if (asSrc->haveAuthorizedKey () && (asSrc->getAuthorizedKey ().getAccountID () != naAccountPublic.getAccountID ()))
|
|
||||||
{
|
|
||||||
return rpcError (rpcPASSWD_CHANGED);
|
|
||||||
}
|
|
||||||
|
|
||||||
saSrcBalance = asSrc->getBalance ();
|
|
||||||
|
|
||||||
if (saSrcBalance < saFee)
|
|
||||||
{
|
|
||||||
WriteLog (lsINFO, RPCHandler) << "authorize: Insufficient funds for fees: fee=" << saFee.getText () << " balance=" << saSrcBalance.getText ();
|
|
||||||
|
|
||||||
return rpcError (rpcINSUF_FUNDS);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
saSrcBalance -= saFee;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Json::Value ();
|
|
||||||
}
|
|
||||||
|
|
||||||
} // RPC
|
|
||||||
} // ripple
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
/*
|
|
||||||
This file is part of rippled: https://github.com/ripple/rippled
|
|
||||||
Copyright (c) 2012-2014 Ripple Labs Inc.
|
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
|
||||||
copyright notice and this permission notice appear in all copies.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
||||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
||||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
//==============================================================================
|
|
||||||
|
|
||||||
#ifndef RIPPLE_RPC_AUTHORIZE_H_INCLUDED
|
|
||||||
#define RIPPLE_RPC_AUTHORIZE_H_INCLUDED
|
|
||||||
|
|
||||||
namespace ripple {
|
|
||||||
namespace RPC {
|
|
||||||
|
|
||||||
Json::Value authorize (
|
|
||||||
Ledger::ref lrLedger,
|
|
||||||
RippleAddress const& naRegularSeed,
|
|
||||||
RippleAddress const& naSrcAccountID,
|
|
||||||
RippleAddress& naAccountPublic,
|
|
||||||
RippleAddress& naAccountPrivate,
|
|
||||||
STAmount& saSrcBalance,
|
|
||||||
STAmount const& saFee,
|
|
||||||
AccountState::pointer& asSrc,
|
|
||||||
RippleAddress const& naVerifyGenerator,
|
|
||||||
NetworkOPs& netOps);
|
|
||||||
|
|
||||||
} // RPC
|
|
||||||
} // ripple
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -17,8 +17,6 @@
|
|||||||
*/
|
*/
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
#include <tuple>
|
|
||||||
|
|
||||||
#include <BeastConfig.h>
|
#include <BeastConfig.h>
|
||||||
|
|
||||||
// Unfortunate but necessary since RPC handlers can literally do anything
|
// Unfortunate but necessary since RPC handlers can literally do anything
|
||||||
@@ -101,7 +99,6 @@
|
|||||||
|
|
||||||
#include <ripple/rpc/impl/AccountFromString.cpp>
|
#include <ripple/rpc/impl/AccountFromString.cpp>
|
||||||
#include <ripple/rpc/impl/Accounts.cpp>
|
#include <ripple/rpc/impl/Accounts.cpp>
|
||||||
#include <ripple/rpc/impl/Authorize.cpp>
|
|
||||||
#include <ripple/rpc/impl/GetMasterGenerator.cpp>
|
#include <ripple/rpc/impl/GetMasterGenerator.cpp>
|
||||||
#include <ripple/rpc/impl/Handler.cpp>
|
#include <ripple/rpc/impl/Handler.cpp>
|
||||||
#include <ripple/rpc/impl/LegacyPathFind.cpp>
|
#include <ripple/rpc/impl/LegacyPathFind.cpp>
|
||||||
|
|||||||
Reference in New Issue
Block a user