Remove WalletAdd (RIPD-725)

This commit is contained in:
Nik Bougalis
2014-12-11 01:29:46 -08:00
parent a8578c73f8
commit 312aec79ca
6 changed files with 1 additions and 146 deletions

View File

@@ -2107,9 +2107,6 @@
</ClCompile>
<ClInclude Include="..\..\src\ripple\app\peers\UniqueNodeList.h">
</ClInclude>
<ClCompile Include="..\..\src\ripple\app\transactors\AddWallet.cpp">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\src\ripple\app\transactors\CancelOffer.cpp">
<ExcludedFromBuild>True</ExcludedFromBuild>
</ClCompile>

View File

@@ -3102,9 +3102,6 @@
<ClInclude Include="..\..\src\ripple\app\peers\UniqueNodeList.h">
<Filter>ripple\app\peers</Filter>
</ClInclude>
<ClCompile Include="..\..\src\ripple\app\transactors\AddWallet.cpp">
<Filter>ripple\app\transactors</Filter>
</ClCompile>
<ClCompile Include="..\..\src\ripple\app\transactors\CancelOffer.cpp">
<Filter>ripple\app\transactors</Filter>
</ClCompile>

View File

@@ -1,134 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of rippled: https://github.com/ripple/rippled
Copyright (c) 2012, 2013 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/app/transactors/Transactor.h>
#include <ripple/basics/Log.h>
#include <ripple/protocol/Indexes.h>
#include <ripple/protocol/TxFlags.h>
namespace ripple {
class AddWallet
: public Transactor
{
public:
AddWallet (
STTx const& txn,
TransactionEngineParams params,
TransactionEngine* engine)
: Transactor (
txn,
params,
engine,
deprecatedLogs().journal("AddWallet"))
{
}
TER doApply () override
{
std::uint32_t const uTxFlags = mTxn.getFlags ();
if (uTxFlags & tfUniversalMask)
{
m_journal.trace <<
"Malformed transaction: Invalid flags set.";
return temINVALID_FLAG;
}
Blob const vucPubKey = mTxn.getFieldVL (sfPublicKey);
Blob const vucSignature = mTxn.getFieldVL (sfSignature);
auto const uAuthKeyID = mTxn.getFieldAccount160 (sfRegularKey);
auto const naMasterPubKey =
RippleAddress::createAccountPublic (vucPubKey);
auto const uDstAccountID = naMasterPubKey.getAccountID ();
// FIXME: This should be moved to the transaction's signature check logic
// and cached.
if (!naMasterPubKey.accountPublicVerify (
Serializer::getSHA512Half (uAuthKeyID.begin (), uAuthKeyID.size ()),
vucSignature, ECDSA::not_strict))
{
m_journal.trace <<
"Unauthorized: bad signature ";
return tefBAD_ADD_AUTH;
}
SLE::pointer sleDst (mEngine->entryCache (
ltACCOUNT_ROOT, getAccountRootIndex (uDstAccountID)));
if (sleDst)
{
m_journal.trace <<
"account already created";
return tefCREATED;
}
// Direct XRP payment.
STAmount saDstAmount = mTxn.getFieldAmount (sfAmount);
STAmount saPaid = mTxn.getTransactionFee ();
STAmount const saSrcBalance = mTxnAccount->getFieldAmount (sfBalance);
std::uint32_t const uOwnerCount = mTxnAccount->getFieldU32 (sfOwnerCount);
std::uint64_t const uReserve = mEngine->getLedger ()->getReserve (uOwnerCount);
// Make sure have enough reserve to send. Allow final spend to use reserve
// for fee.
// Note: Reserve is not scaled by fee.
if (saSrcBalance + saPaid < saDstAmount + uReserve)
{
// Vote no. However, transaction might succeed, if applied in a
// different order.
m_journal.trace <<
"Delay transaction: Insufficient funds: %s / %s (%d)" <<
saSrcBalance.getText () << " / " <<
(saDstAmount + uReserve).getText () << " with reserve = " <<
uReserve;
return tecUNFUNDED_ADD;
}
// Deduct initial balance from source account.
mTxnAccount->setFieldAmount (sfBalance, saSrcBalance - saDstAmount);
// Create the account.
sleDst = mEngine->entryCreate (ltACCOUNT_ROOT,
getAccountRootIndex (uDstAccountID));
sleDst->setFieldAccount (sfAccount, uDstAccountID);
sleDst->setFieldU32 (sfSequence, 1);
sleDst->setFieldAmount (sfBalance, saDstAmount);
sleDst->setFieldAccount (sfRegularKey, uAuthKeyID);
return tesSUCCESS;
}
};
TER
transact_AddWallet (
STTx const& txn,
TransactionEngineParams params,
TransactionEngine* engine)
{
return AddWallet (txn, params, engine).apply ();
}
}

View File

@@ -30,7 +30,6 @@ TER transact_SetRegularKey (STTx const& txn, TransactionEngineParams params, Tra
TER transact_SetTrust (STTx const& txn, TransactionEngineParams params, TransactionEngine* engine);
TER transact_CreateOffer (STTx const& txn, TransactionEngineParams params, TransactionEngine* engine);
TER transact_CancelOffer (STTx const& txn, TransactionEngineParams params, TransactionEngine* engine);
TER transact_AddWallet (STTx const& txn, TransactionEngineParams params, TransactionEngine* engine);
TER transact_Change (STTx const& txn, TransactionEngineParams params, TransactionEngine* engine);
TER transact_CreateTicket (STTx const& txn, TransactionEngineParams params, TransactionEngine* engine);
TER transact_CancelTicket (STTx const& txn, TransactionEngineParams params, TransactionEngine* engine);
@@ -61,9 +60,6 @@ Transactor::transact (
case ttOFFER_CANCEL:
return transact_CancelOffer (txn, params, engine);
case ttWALLET_ADD:
return transact_AddWallet (txn, params, engine);
case ttAMENDMENT:
case ttFEE:
return transact_Change (txn, params, engine);

View File

@@ -36,7 +36,7 @@ enum TxType
ttPAYMENT = 0,
ttCLAIM = 1, // open
ttWALLET_ADD = 2,
ttWALLET_ADD = 2, // unused
ttACCOUNT_SET = 3,
ttPASSWORD_FUND = 4, // open
ttREGULAR_KEY_SET = 5,

View File

@@ -29,7 +29,6 @@
#include <ripple/app/transactors/Payment.cpp>
#include <ripple/app/transactors/SetRegularKey.cpp>
#include <ripple/app/transactors/SetAccount.cpp>
#include <ripple/app/transactors/AddWallet.cpp>
#include <ripple/app/transactors/SetTrust.cpp>
#include <ripple/app/transactors/CreateOffer.cpp>
#include <ripple/app/transactors/CreateTicket.cpp>