mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-26 14:05:51 +00:00
Fee change bugfixes.
This commit is contained in:
@@ -54,9 +54,9 @@ Application::Application() :
|
||||
mSNTPClient(mAuxService), mJobQueue(mIOService), mFeeTrack(),
|
||||
|
||||
#ifdef RESERVE_BASE_100
|
||||
mFeeVote(10, 100, 25),
|
||||
mFeeVote(10, 100 * SYSTEM_CURRENCY_PARTS, 25 * SYSTEM_CURRENCY_PARTS),
|
||||
#else
|
||||
mFeeVote(10, 200, 50),
|
||||
mFeeVote(10, 200 * SYSTEM_CURRENCY_PARTS, 50 * SYSTEM_CURRENCY_PARTS),
|
||||
#endif
|
||||
|
||||
mRpcDB(NULL), mTxnDB(NULL), mLedgerDB(NULL), mWalletDB(NULL),
|
||||
|
||||
@@ -43,12 +43,6 @@ TER ChangeTransactor::checkSeq()
|
||||
|
||||
TER ChangeTransactor::payFee()
|
||||
{
|
||||
if (isSetBit(mParams, tapOPEN_LEDGER))
|
||||
{
|
||||
cLog(lsWARNING) << "Change transaction against open ledger";
|
||||
return temINVALID;
|
||||
}
|
||||
|
||||
if (mTxn.getTransactionFee() != STAmount())
|
||||
{
|
||||
cLog(lsWARNING) << "Change transaction with non-zero fee";
|
||||
@@ -58,6 +52,25 @@ TER ChangeTransactor::payFee()
|
||||
return tesSUCCESS;
|
||||
}
|
||||
|
||||
TER ChangeTransactor::preCheck()
|
||||
{
|
||||
mTxnAccountID = mTxn.getSourceAccount().getAccountID();
|
||||
if (mTxnAccountID.isNonZero())
|
||||
{
|
||||
cLog(lsWARNING) << "applyTransaction: bad source id";
|
||||
|
||||
return temBAD_SRC_ACCOUNT;
|
||||
}
|
||||
|
||||
if (isSetBit(mParams, tapOPEN_LEDGER))
|
||||
{
|
||||
cLog(lsWARNING) << "Change transaction against open ledger";
|
||||
return temINVALID;
|
||||
}
|
||||
|
||||
return tesSUCCESS;
|
||||
}
|
||||
|
||||
TER ChangeTransactor::applyFeature()
|
||||
{
|
||||
uint256 feature = mTxn.getFieldH256(sfFeature);
|
||||
@@ -84,12 +97,16 @@ TER ChangeTransactor::applyFee()
|
||||
if (!feeObject)
|
||||
feeObject = mEngine->entryCreate(ltFEE_SETTINGS, Ledger::getLedgerFeeIndex());
|
||||
|
||||
cLog(lsINFO) << "Previous fee object: " << feeObject->getJson(0);
|
||||
|
||||
feeObject->setFieldU64(sfBaseFee, mTxn.getFieldU64(sfBaseFee));
|
||||
feeObject->setFieldU32(sfReferenceFeeUnits, mTxn.getFieldU32(sfReferenceFeeUnits));
|
||||
feeObject->setFieldU32(sfReserveBase, mTxn.getFieldU32(sfReserveBase));
|
||||
feeObject->setFieldU32(sfReserveIncrement, mTxn.getFieldU32(sfReserveIncrement));
|
||||
|
||||
mEngine->entryModify(feeObject);
|
||||
|
||||
cLog(lsINFO) << "New fee object: " << feeObject->getJson(0);
|
||||
cLog(lsWARNING) << "Fees have been changed";
|
||||
return tesSUCCESS;
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ protected:
|
||||
TER applyFeature();
|
||||
TER applyFee();
|
||||
|
||||
bool mustHaveValidAccount() { return false; }
|
||||
|
||||
public:
|
||||
ChangeTransactor(const SerializedTransaction& txn, TransactionEngineParams params, TransactionEngine *engine)
|
||||
: Transactor(txn, params, engine)
|
||||
@@ -16,6 +18,7 @@ public:
|
||||
TER checkSig();
|
||||
TER checkSeq();
|
||||
TER payFee();
|
||||
TER preCheck();
|
||||
};
|
||||
|
||||
// vim:ts=4
|
||||
|
||||
@@ -352,17 +352,16 @@ void FeeVote::doFeeVoting(Ledger::ref lastClosedLedger, SHAMap::ref initialPosit
|
||||
{
|
||||
cLog(lsWARNING) << "We are voting for a fee change: " << baseFee << "/" << baseReserve << "/" << incReserve;
|
||||
SerializedTransaction trans(ttFEE);
|
||||
trans.setFieldAccount(sfAccount, uint160());
|
||||
trans.setFieldU64(sfBaseFee, baseFee);
|
||||
trans.setFieldU32(sfReferenceFeeUnits, 10);
|
||||
trans.setFieldU32(sfReserveBase, baseReserve);
|
||||
trans.setFieldU32(sfReserveIncrement, incReserve);
|
||||
|
||||
uint256 txID = trans.getTransactionID();
|
||||
cLog(lsWARNING) << "Vote: " << txID;
|
||||
|
||||
Serializer s;
|
||||
s.add32(sHP_TransactionID);
|
||||
trans.add(s, true);
|
||||
uint256 txID = s.getSHA512Half();
|
||||
cLog(lsWARNING) << "Vote: " << txID;
|
||||
|
||||
SHAMapItem::pointer tItem = boost::make_shared<SHAMapItem>(txID, s.peekData());
|
||||
if (!initialPosition->addGiveItem(tItem, true, false))
|
||||
|
||||
@@ -319,7 +319,8 @@ void LedgerConsensus::takeInitialPosition(Ledger& initialLedger)
|
||||
{
|
||||
SHAMap::pointer initialSet;
|
||||
|
||||
if (mProposing && mHaveCorrectLCL && ((mPreviousLedger->getLedgerSeq() % 256) == 0))
|
||||
if ((theConfig.RUN_STANDALONE || (mProposing && mHaveCorrectLCL))
|
||||
&& ((mPreviousLedger->getLedgerSeq() % 256) == 0))
|
||||
{ // previous ledger was flag ledger
|
||||
SHAMap::pointer preSet = initialLedger.peekTransactionMap()->snapShot(true);
|
||||
theApp->getFeeVote().doFeeVoting(mPreviousLedger, preSet);
|
||||
|
||||
@@ -204,10 +204,13 @@ TER Transactor::apply()
|
||||
|
||||
if (!mTxnAccount)
|
||||
{
|
||||
cLog(lsTRACE) << boost::str(boost::format("applyTransaction: Delay transaction: source account does not exist: %s") %
|
||||
mTxn.getSourceAccount().humanAccountID());
|
||||
if (mustHaveValidAccount())
|
||||
{
|
||||
cLog(lsTRACE) << boost::str(boost::format("applyTransaction: Delay transaction: source account does not exist: %s") %
|
||||
mTxn.getSourceAccount().humanAccountID());
|
||||
|
||||
return terNO_ACCOUNT;
|
||||
return terNO_ACCOUNT;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -225,7 +228,8 @@ TER Transactor::apply()
|
||||
terResult = checkSig();
|
||||
if (terResult != tesSUCCESS) return(terResult);
|
||||
|
||||
mEngine->entryModify(mTxnAccount);
|
||||
if (mTxnAccount)
|
||||
mEngine->entryModify(mTxnAccount);
|
||||
|
||||
return doApply();
|
||||
}
|
||||
|
||||
@@ -36,6 +36,8 @@ protected:
|
||||
|
||||
Transactor(const SerializedTransaction& txn, TransactionEngineParams params, TransactionEngine* engine);
|
||||
|
||||
virtual bool mustHaveValidAccount() { return true; }
|
||||
|
||||
public:
|
||||
typedef boost::shared_ptr<Transactor> pointer;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user