mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-20 11:05:54 +00:00
regular key set fee
This commit is contained in:
@@ -122,6 +122,7 @@
|
||||
<ClCompile Include="src\cpp\ripple\LedgerMaster.cpp" />
|
||||
<ClCompile Include="src\cpp\ripple\LedgerProposal.cpp" />
|
||||
<ClCompile Include="src\cpp\ripple\LedgerTiming.cpp" />
|
||||
<ClCompile Include="src\cpp\ripple\LoadMonitor.cpp" />
|
||||
<ClCompile Include="src\cpp\ripple\Log.cpp" />
|
||||
<ClCompile Include="src\cpp\ripple\main.cpp" />
|
||||
<ClCompile Include="src\cpp\ripple\NetworkOPs.cpp" />
|
||||
|
||||
@@ -345,6 +345,9 @@
|
||||
<ClCompile Include="src\cpp\ripple\WalletAddTransactor.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\LoadMonitor.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="util\pugiconfig.hpp">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "LoadMonitor.h"
|
||||
|
||||
void LoadMonitor::LoadMonitor::update()
|
||||
void LoadMonitor::update()
|
||||
{ // call with the mutex
|
||||
time_t now = time(NULL);
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ void PaymentTransactor::calculateFee()
|
||||
{
|
||||
if (mTxn.getFlags() & tfCreateAccount)
|
||||
{
|
||||
|
||||
mFeeDue = theConfig.FEE_ACCOUNT_CREATE;
|
||||
}else Transactor::calculateFee();
|
||||
}
|
||||
@@ -146,7 +147,13 @@ TER PaymentTransactor::doApply()
|
||||
else
|
||||
{
|
||||
mTxnAccount->setFieldAmount(sfBalance, saSrcXRPBalance - saDstAmount);
|
||||
sleDst->setFieldAmount(sfBalance, sleDst->getFieldAmount(sfBalance) + saDstAmount);
|
||||
// re-arm the password change fee if we can and need to
|
||||
if ( (sleDst->getFlags() & lsfPasswordSpent) &&
|
||||
(saDstAmount > theConfig.FEE_DEFAULT) )
|
||||
{
|
||||
sleDst->setFieldAmount(sfBalance, sleDst->getFieldAmount(sfBalance) + saDstAmount-theConfig.FEE_DEFAULT);
|
||||
sleDst->clearFlag(lsfPasswordSpent);
|
||||
}else sleDst->setFieldAmount(sfBalance, sleDst->getFieldAmount(sfBalance) + saDstAmount);
|
||||
|
||||
terResult = tesSUCCESS;
|
||||
}
|
||||
|
||||
@@ -4,42 +4,29 @@
|
||||
|
||||
SETUP_LOG();
|
||||
|
||||
// TODO:
|
||||
TER RegularKeySetTransactor::checkSig()
|
||||
{
|
||||
// Transaction's signing public key must be for the source account.
|
||||
// To prove the master private key made this transaction.
|
||||
if (mSigningPubKey.getAccountID() != mTxnAccountID)
|
||||
{
|
||||
// Signing Pub Key must be for Source Account ID.
|
||||
cLog(lsWARNING) << "sourceAccountID: " << mSigningPubKey.humanAccountID();
|
||||
cLog(lsWARNING) << "txn accountID: " << mTxn.getSourceAccount().humanAccountID();
|
||||
|
||||
return temBAD_SET_ID;
|
||||
}
|
||||
return tesSUCCESS;
|
||||
}
|
||||
|
||||
// TODO: this should be default fee if flag isn't set
|
||||
void RegularKeySetTransactor::calculateFee()
|
||||
{
|
||||
mFeeDue = 0;
|
||||
Transactor::calculateFee();
|
||||
|
||||
if ( !(mTxnAccount->getFlags() & lsfPasswordSpent) &&
|
||||
(mSigningPubKey.getAccountID() == mTxnAccountID))
|
||||
{ // flag is armed and they signed with the right account
|
||||
|
||||
mSourceBalance = mTxnAccount->getFieldAmount(sfBalance);
|
||||
if(mSourceBalance < mFeeDue) mFeeDue = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// TODO: change to take a fee if there is one there
|
||||
TER RegularKeySetTransactor::doApply()
|
||||
{
|
||||
std::cerr << "doRegularKeySet>" << std::endl;
|
||||
|
||||
if (mTxnAccount->getFlags() & lsfPasswordSpent)
|
||||
if(mFeeDue.isZero())
|
||||
{
|
||||
std::cerr << "doRegularKeySet: Delay transaction: Funds already spent." << std::endl;
|
||||
|
||||
return terFUNDS_SPENT;
|
||||
}
|
||||
|
||||
mTxnAccount->setFlag(lsfPasswordSpent);
|
||||
}
|
||||
|
||||
uint160 uAuthKeyID=mTxn.getFieldAccount160(sfRegularKey);
|
||||
mTxnAccount->setFieldAccount(sfRegularKey, uAuthKeyID);
|
||||
|
||||
@@ -6,6 +6,5 @@ class RegularKeySetTransactor : public Transactor
|
||||
public:
|
||||
RegularKeySetTransactor(const SerializedTransaction& txn,TransactionEngineParams params, TransactionEngine* engine) : Transactor(txn,params,engine) {}
|
||||
TER checkFee();
|
||||
TER checkSig();
|
||||
TER doApply();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user