mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Transaction fee handling.
This commit is contained in:
@@ -15,7 +15,12 @@ TransactionEngineResult TransactionEngine::applyTransaction(const SerializedTran
|
|||||||
// check signature
|
// check signature
|
||||||
if (!txn.checkSign(acctKey)) return terINVALID;
|
if (!txn.checkSign(acctKey)) return terINVALID;
|
||||||
|
|
||||||
// WRITEME: Check fee
|
uint64 txnFee = txn.getTransactionFee();
|
||||||
|
if ( (params & tepNO_CHECK_FEE) != tepNONE)
|
||||||
|
{
|
||||||
|
// WRITEME: Check if fee is adequate
|
||||||
|
if (txnFee == 0) return terINSUF_FEE_P;
|
||||||
|
}
|
||||||
|
|
||||||
// get source account ID
|
// get source account ID
|
||||||
uint160 srcAccount = txn.getSigningAccount();
|
uint160 srcAccount = txn.getSigningAccount();
|
||||||
@@ -26,7 +31,14 @@ TransactionEngineResult TransactionEngine::applyTransaction(const SerializedTran
|
|||||||
// find source account
|
// find source account
|
||||||
LedgerStateParms qry = lepNONE;
|
LedgerStateParms qry = lepNONE;
|
||||||
SerializedLedgerEntry::pointer src = mLedger->getAccountRoot(qry, srcAccount);
|
SerializedLedgerEntry::pointer src = mLedger->getAccountRoot(qry, srcAccount);
|
||||||
if(!src) return terNO_ACCOUNT;
|
if (!src) return terNO_ACCOUNT;
|
||||||
|
|
||||||
|
// deduct the fee, so it's not available during the transaction
|
||||||
|
// we only write the account back if the transaction succeeds
|
||||||
|
uint64 balance = src->getIFieldU64(sfBalance);
|
||||||
|
if (balance < txnFee)
|
||||||
|
return terINSUF_FEE_B;
|
||||||
|
src->setIFieldU64(sfBalance, balance - txnFee);
|
||||||
|
|
||||||
// validate sequence
|
// validate sequence
|
||||||
uint32 t_seq = txn.getSequence();
|
uint32 t_seq = txn.getSequence();
|
||||||
@@ -81,3 +93,39 @@ TransactionEngineResult TransactionEngine::applyTransaction(const SerializedTran
|
|||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TransactionEngineResult TransactionEngine::doPayment(const SerializedTransaction& txn, SerializedLedgerEntry& source)
|
||||||
|
{
|
||||||
|
return terUNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
TransactionEngineResult TransactionEngine::doInvoice(const SerializedTransaction&, SerializedLedgerEntry& source)
|
||||||
|
{
|
||||||
|
return terUNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
TransactionEngineResult TransactionEngine::doOffer(const SerializedTransaction&, SerializedLedgerEntry& source)
|
||||||
|
{
|
||||||
|
return terUNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
TransactionEngineResult TransactionEngine::doTake(const SerializedTransaction&, SerializedLedgerEntry& source)
|
||||||
|
{
|
||||||
|
return terUNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
TransactionEngineResult TransactionEngine::doCancel(const SerializedTransaction&, SerializedLedgerEntry& source)
|
||||||
|
{
|
||||||
|
return terUNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
TransactionEngineResult TransactionEngine::doStore(const SerializedTransaction&, SerializedLedgerEntry& source)
|
||||||
|
{
|
||||||
|
return terUNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
TransactionEngineResult TransactionEngine::doDelete(const SerializedTransaction&, SerializedLedgerEntry& source)
|
||||||
|
{
|
||||||
|
return terUNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user