Remove wallet_accounts and generator maps (RIPD-804):

* Remove the deprecated wallet_accounts command.
 * Remove dead code for generator maps.
 * Remove the help for the obsolete wallet_add and wallet_claim commands
   (which have already been removed).
This commit is contained in:
Josh Juran
2015-04-21 16:42:39 -07:00
committed by Nik Bougalis
parent d182d1455e
commit daf4f8fcde
23 changed files with 1 additions and 270 deletions

View File

@@ -3290,9 +3290,6 @@
</ClCompile>
<ClInclude Include="..\..\src\ripple\rpc\handlers\Version.h">
</ClInclude>
<ClCompile Include="..\..\src\ripple\rpc\handlers\WalletAccounts.cpp">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\src\ripple\rpc\handlers\WalletPropose.cpp">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>
@@ -3316,11 +3313,6 @@
</ClCompile>
<ClInclude Include="..\..\src\ripple\rpc\impl\DoPrint.h">
</ClInclude>
<ClCompile Include="..\..\src\ripple\rpc\impl\GetMasterGenerator.cpp">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>
<ClInclude Include="..\..\src\ripple\rpc\impl\GetMasterGenerator.h">
</ClInclude>
<ClCompile Include="..\..\src\ripple\rpc\impl\Handler.cpp">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>

View File

@@ -3846,9 +3846,6 @@
<ClInclude Include="..\..\src\ripple\rpc\handlers\Version.h">
<Filter>ripple\rpc\handlers</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ripple\rpc\handlers\WalletAccounts.cpp">
<Filter>ripple\rpc\handlers</Filter>
</ClCompile>
<ClCompile Include="..\..\src\ripple\rpc\handlers\WalletPropose.cpp">
<Filter>ripple\rpc\handlers</Filter>
</ClCompile>
@@ -3876,12 +3873,6 @@
<ClInclude Include="..\..\src\ripple\rpc\impl\DoPrint.h">
<Filter>ripple\rpc\impl</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ripple\rpc\impl\GetMasterGenerator.cpp">
<Filter>ripple\rpc\impl</Filter>
</ClCompile>
<ClInclude Include="..\..\src\ripple\rpc\impl\GetMasterGenerator.h">
<Filter>ripple\rpc\impl</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ripple\rpc\impl\Handler.cpp">
<Filter>ripple\rpc\impl</Filter>
</ClCompile>

View File

@@ -1386,11 +1386,6 @@ SLE::pointer Ledger::getDirNode (uint256 const& uNodeIndex) const
return getASNodeI (uNodeIndex, ltDIR_NODE);
}
SLE::pointer Ledger::getGenerator (Account const& uGeneratorID) const
{
return getASNodeI (getGeneratorIndex (uGeneratorID), ltGENERATOR_MAP);
}
SLE::pointer
Ledger::getOffer (uint256 const& uIndex) const
{

View File

@@ -342,12 +342,6 @@ public:
std::vector<uint256> getNeededAccountStateHashes (
int max, SHAMapSyncFilter* filter) const;
//
// Generator Map functions
//
SLE::pointer getGenerator (Account const& uGeneratorID) const;
//
// Offer functions
//

View File

@@ -290,10 +290,6 @@ Json::Value LedgerEntrySet::getJson (int) const
entry[jss::type] = "dir_node";
break;
case ltGENERATOR_MAP:
entry[jss::type] = "generator_map";
break;
case ltRIPPLE_STATE:
entry[jss::type] = "ripple_state";
break;

View File

@@ -147,9 +147,6 @@ void printHelp (const po::options_description& desc)
" unl_reset\n"
" validation_create [<seed>|<pass_phrase>|<key>]\n"
" validation_seed [<seed>|<pass_phrase>|<key>]\n"
" wallet_accounts <seed>\n"
" wallet_add <regular_seed> <paying_account> <master_seed> [<initial_funds>] [<account_annotation>]\n"
" wallet_claim <master_seed> <regular_seed> [<source_tag>] [<account_annotation>]\n"
" wallet_propose [<passphrase>]\n"
" wallet_seed [<seed>|<passphrase>|<passkey>]\n";
}

View File

@@ -260,8 +260,6 @@ public:
std::function <bool (SLE::ref)> func) const override;
AccountState::pointer getAccountState (
Ledger::ref lrLedger, RippleAddress const& accountID);
SLE::pointer getGenerator (
Ledger::ref lrLedger, Account const& uGeneratorID);
//
// Directory functions
@@ -1196,15 +1194,6 @@ AccountState::pointer NetworkOPsImp::getAccountState (
return lrLedger->getAccountState (accountID);
}
SLE::pointer NetworkOPsImp::getGenerator (
Ledger::ref lrLedger, Account const& uGeneratorID)
{
if (!lrLedger)
return SLE::pointer ();
return lrLedger->getGenerator (uGeneratorID);
}
//
// Directory functions
//
@@ -1295,7 +1284,6 @@ Json::Value NetworkOPsImp::getOwnerInfo (
case ltACCOUNT_ROOT:
case ltDIR_NODE:
case ltGENERATOR_MAP:
default:
assert (false);
break;

View File

@@ -171,8 +171,6 @@ public:
std::function <bool (SLE::ref)> func) const = 0;
virtual AccountState::pointer getAccountState (Ledger::ref lrLedger,
RippleAddress const& accountID) = 0;
virtual SLE::pointer getGenerator (Ledger::ref lrLedger,
Account const& uGeneratorID) = 0;
//--------------------------------------------------------------------------
//

View File

@@ -721,16 +721,6 @@ private:
return jvRequest;
}
// wallet_accounts <seed>
Json::Value parseWalletAccounts (Json::Value const& jvParams)
{
Json::Value jvRequest;
jvRequest[jss::seed] = jvParams[0u].asString ();
return jvRequest;
}
// wallet_propose [<passphrase>]
// <passphrase> is only for testing. Master seeds should only be generated randomly.
Json::Value parseWalletPropose (Json::Value const& jvParams)
@@ -859,7 +849,6 @@ public:
{ "validation_create", &RPCParser::parseValidationCreate, 0, 1 },
{ "validation_seed", &RPCParser::parseValidationSeed, 0, 1 },
{ "version", &RPCParser::parseAsIs, 0, 0 },
{ "wallet_accounts", &RPCParser::parseWalletAccounts, 1, 1 },
{ "wallet_propose", &RPCParser::parseWalletPropose, 0, 1 },
{ "wallet_seed", &RPCParser::parseWalletSeed, 0, 1 },
{ "internal", &RPCParser::parseInternal, 1, -1 },

View File

@@ -110,10 +110,8 @@ enum error_code_i
// Internal error (should never happen)
rpcINTERNAL, // Generic internal error.
rpcFAIL_GEN_DECRYPT,
rpcNOT_IMPL,
rpcNOT_SUPPORTED,
rpcNO_GEN_DECRYPT,
};
//------------------------------------------------------------------------------

View File

@@ -50,8 +50,6 @@ enum LedgerEntryType
*/
ltDIR_NODE = 'd',
ltGENERATOR_MAP = 'g',
/** Describes a trust line.
*/
ltRIPPLE_STATE = 'r',

View File

@@ -386,7 +386,6 @@ extern TypedField<STBlob> const sfPublicKey;
extern SField const sfMessageKey;
extern TypedField<STBlob> const sfSigningPubKey;
extern SField const sfTxnSignature;
extern SField const sfGenerator;
extern TypedField<STBlob> const sfSignature;
extern SField const sfDomain;
extern SField const sfFundCode;

View File

@@ -64,7 +64,6 @@ public:
add (rpcDST_ACT_MISSING, "dstActMissing", "Destination account does not exist.");
add (rpcDST_AMT_MALFORMED, "dstAmtMalformed", "Destination amount/currency/issuer is malformed.");
add (rpcDST_ISR_MALFORMED, "dstIsrMalformed", "Destination issuer is malformed.");
add (rpcFAIL_GEN_DECRYPT, "failGenDecrypt", "Failed to decrypt generator.");
add (rpcFORBIDDEN, "forbidden", "Bad credentials.");
add (rpcGENERAL, "general", "Generic error reason.");
add (rpcGETS_ACT_MALFORMED, "getsActMalformed", "Gets account malformed.");
@@ -89,7 +88,6 @@ public:
add (rpcNO_CLOSED, "noClosed", "Closed ledger is unavailable.");
add (rpcNO_CURRENT, "noCurrent", "Current ledger is unavailable.");
add (rpcNO_EVENTS, "noEvents", "Current transport does not support events.");
add (rpcNO_GEN_DECRYPT, "noGenDecrypt", "Password failed to decrypt master public generator.");
add (rpcNO_NETWORK, "noNetwork", "Not synced to Ripple network.");
add (rpcNO_PATH, "noPath", "Unable to find a ripple path.");
add (rpcNO_PERMISSION, "noPermission", "You don't have permission for this command.");

View File

@@ -54,10 +54,6 @@ LedgerFormats::LedgerFormats ()
<< SOElement (sfIndexPrevious, SOE_OPTIONAL)
;
add ("GeneratorMap", ltGENERATOR_MAP)
<< SOElement (sfGenerator, SOE_REQUIRED)
;
add ("Offer", ltOFFER)
<< SOElement (sfAccount, SOE_REQUIRED)
<< SOElement (sfSequence, SOE_REQUIRED)

View File

@@ -176,7 +176,6 @@ TypedField<STBlob> const sfSigningPubKey = make::one<STBlob>(&sfSigningPubKey
TypedField<STBlob> const sfSignature = make::one<STBlob>(&sfSignature, STI_VL, 6, "Signature", SField::sMD_Default, false);
SField const sfMessageKey = make::one(&sfMessageKey, STI_VL, 2, "MessageKey");
SField const sfTxnSignature = make::one(&sfTxnSignature, STI_VL, 4, "TxnSignature", SField::sMD_Default, false);
SField const sfGenerator = make::one(&sfGenerator, STI_VL, 5, "Generator");
SField const sfDomain = make::one(&sfDomain, STI_VL, 7, "Domain");
SField const sfFundCode = make::one(&sfFundCode, STI_VL, 8, "FundCode");
SField const sfRemoveCode = make::one(&sfRemoveCode, STI_VL, 9, "RemoveCode");

View File

@@ -161,7 +161,6 @@ Json::Value doAccountObjects (RPC::Context& context)
// case ltACCOUNT_ROOT:
// case ltDIR_NODE:
// case ltGENERATOR_MAP:
default:
if (! jv.isNull ())
jv = Json::nullValue;

View File

@@ -79,7 +79,6 @@ Json::Value doUnlScore (RPC::Context&);
Json::Value doUnsubscribe (RPC::Context&);
Json::Value doValidationCreate (RPC::Context&);
Json::Value doValidationSeed (RPC::Context&);
Json::Value doWalletAccounts (RPC::Context&);
Json::Value doWalletLock (RPC::Context&);
Json::Value doWalletPropose (RPC::Context&);
Json::Value doWalletSeed (RPC::Context&);

View File

@@ -1,75 +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 <BeastConfig.h>
#include <ripple/rpc/impl/Accounts.h>
#include <ripple/rpc/impl/GetMasterGenerator.h>
namespace ripple {
// {
// seed: <string>
// ledger_hash : <ledger>
// ledger_index : <ledger_index>
// }
Json::Value doWalletAccounts (RPC::Context& context)
{
Ledger::pointer ledger;
Json::Value jvResult
= RPC::lookupLedger (context.params, ledger, context.netOps);
if (!ledger)
return jvResult;
RippleAddress naSeed;
if (!context.params.isMember (jss::seed)
|| !naSeed.setSeedGeneric (context.params[jss::seed].asString ()))
{
return rpcError (rpcBAD_SEED);
}
// Try the seed as a master seed.
RippleAddress naMasterGenerator
= RippleAddress::createGeneratorPublic (naSeed);
Json::Value jsonAccounts
= RPC::accounts (ledger, naMasterGenerator, context.netOps);
if (jsonAccounts.empty ())
{
// No account via seed as master, try seed a regular.
Json::Value ret = RPC::getMasterGenerator (
ledger, naSeed, naMasterGenerator, context.netOps);
if (!ret.empty ())
return ret;
ret[jss::accounts]
= RPC::accounts (ledger, naMasterGenerator, context.netOps);
return ret;
}
else
{
// Had accounts via seed as master, return them.
return RPC::makeObjectValue (jsonAccounts, jss::accounts);
}
}
} // ripple

View File

@@ -60,30 +60,10 @@ Json::Value accountFromString (
// We allow the use of the seeds to access #0.
// This is poor practice and merely for debugging convenience.
RippleAddress naRegular0Public;
RippleAddress naRegular0Private;
auto naGenerator = RippleAddress::createGeneratorPublic (naSeed);
naRegular0Public.setAccountPublic (naGenerator, 0);
naRegular0Private.setAccountPrivate (naGenerator, naSeed, 0);
SLE::pointer sleGen = netOps.getGenerator (
lrLedger, naRegular0Public.getAccountID ());
if (sleGen)
{
// Found master public key.
Blob vucCipher = sleGen->getFieldVL (sfGenerator);
Blob vucMasterGenerator = naRegular0Private.accountPrivateDecrypt (
naRegular0Public, vucCipher);
if (vucMasterGenerator.empty ())
rpcError (rpcNO_GEN_DECRYPT);
naGenerator.setGenerator (vucMasterGenerator);
}
// Otherwise, if we didn't find a generator map, assume it is a master
// Generator maps don't exist. Assume it is a master
// generator.
bIndex = !iIndex;

View File

@@ -1,62 +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 <BeastConfig.h>
#include <ripple/rpc/impl/GetMasterGenerator.h>
namespace ripple {
namespace RPC {
// Look up the master public generator for a regular seed so we may index source accounts ids.
// --> naRegularSeed
// <-- naMasterGenerator
Json::Value getMasterGenerator (
Ledger::ref lrLedger, RippleAddress const& naRegularSeed,
RippleAddress& naMasterGenerator, NetworkOPs& netOps)
{
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);
SLE::pointer sleGen = netOps.getGenerator (lrLedger, na0Public.getAccountID ());
if (!sleGen)
{
// No account has been claimed or has had it password set for seed.
return rpcError (rpcNO_ACCOUNT);
}
Blob vucCipher = sleGen->getFieldVL (sfGenerator);
Blob vucMasterGenerator = na0Private.accountPrivateDecrypt (na0Public, vucCipher);
if (vucMasterGenerator.empty ())
{
return rpcError (rpcFAIL_GEN_DECRYPT);
}
naMasterGenerator.setGenerator (vucMasterGenerator);
return Json::Value (Json::objectValue);
}
} // RPC
} // ripple

View File

@@ -1,35 +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_GETMASTERGENERATOR_H_INCLUDED
#define RIPPLE_RPC_GETMASTERGENERATOR_H_INCLUDED
namespace ripple {
namespace RPC {
Json::Value getMasterGenerator (
Ledger::ref lrLedger,
RippleAddress const& naRegularSeed,
RippleAddress& naMasterGenerator,
NetworkOPs& netOps);
} // RPC
} // ripple
#endif

View File

@@ -149,7 +149,6 @@ HandlerTable HANDLERS({
{ "unl_score", byRef (&doUnlScore), Role::ADMIN, NO_CONDITION },
{ "validation_create", byRef (&doValidationCreate), Role::ADMIN, NO_CONDITION },
{ "validation_seed", byRef (&doValidationSeed), Role::ADMIN, NO_CONDITION },
{ "wallet_accounts", byRef (&doWalletAccounts), Role::USER, NO_CONDITION },
{ "wallet_propose", byRef (&doWalletPropose), Role::ADMIN, NO_CONDITION },
{ "wallet_seed", byRef (&doWalletSeed), Role::ADMIN, NO_CONDITION },

View File

@@ -89,13 +89,11 @@
#include <ripple/rpc/handlers/Unsubscribe.cpp>
#include <ripple/rpc/handlers/ValidationCreate.cpp>
#include <ripple/rpc/handlers/ValidationSeed.cpp>
#include <ripple/rpc/handlers/WalletAccounts.cpp>
#include <ripple/rpc/handlers/WalletPropose.cpp>
#include <ripple/rpc/handlers/WalletSeed.cpp>
#include <ripple/rpc/impl/AccountFromString.cpp>
#include <ripple/rpc/impl/Accounts.cpp>
#include <ripple/rpc/impl/GetMasterGenerator.cpp>
#include <ripple/rpc/impl/Handler.cpp>
#include <ripple/rpc/impl/KeypairForSignature.cpp>
#include <ripple/rpc/impl/LegacyPathFind.cpp>