Transactor Architecture
Introduction
The Transactor Base Class
Core Class Structure
class Transactor
{
protected:
ApplyContext& ctx_;
beast::WrappedSink sink_;
beast::Journal const j_;
AccountID const account_;
XRPAmount mPriorBalance; // Balance before fees.
XRPAmount mSourceBalance; // Balance after fees.
public:
enum ConsequencesFactoryType { Normal, Blocker, Custom };
// Main entry point for transaction application
ApplyResult operator()();
ApplyView& view();
ApplyView const& view() const;
// Static methods for validation phases
static NotTEC checkSeqProxy(ReadView const& view, STTx const& tx, beast::Journal j);
static NotTEC checkPriorTxAndLastLedger(PreclaimContext const& ctx);
static TER checkFee(PreclaimContext const& ctx, XRPAmount baseFee);
static NotTEC checkSign(PreclaimContext const& ctx);
static XRPAmount calculateBaseFee(ReadView const& view, STTx const& tx);
// Default implementations that derived classes can override
static TER preclaim(PreclaimContext const& ctx) { return tesSUCCESS; }
protected:
TER apply();
explicit Transactor(ApplyContext& ctx);
virtual void preCompute();
virtual TER doApply() = 0; // Pure virtual - must be implemented
};Context Objects
PreflightContext
PreclaimContext
ApplyContext
Transaction Type Registration
Example: CheckCreate Registration
The Transactor Hierarchy
The invokePreflight Template
Key Member Variables
account_
mPriorBalance and mSourceBalance
ctx_
Helper Methods
view()
calculateBaseFee()
minimumFee()
Codebase References
File
Description
Key Takeaways
Last updated

