mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Conditionally enable tickets at run time
This commit is contained in:
committed by
Nik Bougalis
parent
e958f72ba9
commit
4f34724c5a
@@ -160,7 +160,8 @@ Env::submit (JTx const& tx)
|
||||
bool didApply;
|
||||
if (stx)
|
||||
{
|
||||
TransactionEngine txe (ledger, multisign);
|
||||
TransactionEngine txe (ledger,
|
||||
tx_enable_test);
|
||||
std::tie(ter, didApply) = txe.applyTransaction(
|
||||
*stx, tapOPEN_LEDGER |
|
||||
(true ? tapNONE : tapNO_CHECK_SIGN));
|
||||
|
||||
@@ -30,8 +30,8 @@ namespace ripple {
|
||||
// A TransactionEngine applies serialized transactions to a ledger
|
||||
// It can also, verify signatures, verify fees, and give rejection reasons
|
||||
|
||||
struct multisign_t { multisign_t() { } };
|
||||
static multisign_t const multisign;
|
||||
struct tx_enable_test_t { tx_enable_test_t() { } };
|
||||
static tx_enable_test_t const tx_enable_test;
|
||||
|
||||
// One instance per ledger.
|
||||
// Only one transaction applied at a time.
|
||||
@@ -45,8 +45,17 @@ private:
|
||||
false;
|
||||
#endif
|
||||
|
||||
bool enableTickets_ =
|
||||
#if RIPPLE_ENABLE_TICKETS
|
||||
true;
|
||||
#else
|
||||
false;
|
||||
#endif
|
||||
|
||||
boost::optional<LedgerEntrySet> mNodes;
|
||||
|
||||
void txnWrite();
|
||||
|
||||
protected:
|
||||
Ledger::pointer mLedger;
|
||||
int mTxnSeq = 0;
|
||||
@@ -61,8 +70,10 @@ public:
|
||||
assert (mLedger);
|
||||
}
|
||||
|
||||
TransactionEngine (Ledger::ref ledger, multisign_t)
|
||||
TransactionEngine (Ledger::ref ledger,
|
||||
tx_enable_test_t)
|
||||
: enableMultiSign_(true)
|
||||
, enableTickets_(true)
|
||||
, mLedger (ledger)
|
||||
{
|
||||
assert (mLedger);
|
||||
@@ -74,6 +85,12 @@ public:
|
||||
return enableMultiSign_;
|
||||
}
|
||||
|
||||
bool
|
||||
enableTickets() const
|
||||
{
|
||||
return enableTickets_;
|
||||
}
|
||||
|
||||
LedgerEntrySet&
|
||||
view ()
|
||||
{
|
||||
|
||||
@@ -93,11 +93,9 @@ transact_CancelTicket (
|
||||
TransactionEngineParams params,
|
||||
TransactionEngine* engine)
|
||||
{
|
||||
#if RIPPLE_ENABLE_TICKETS
|
||||
return CancelTicket (txn, params, engine).apply ();
|
||||
#else
|
||||
return temDISABLED;
|
||||
#endif
|
||||
if (! engine->enableTickets())
|
||||
return temDISABLED;
|
||||
return CancelTicket (txn, params, engine).apply();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -145,11 +145,9 @@ transact_CreateTicket (
|
||||
TransactionEngineParams params,
|
||||
TransactionEngine* engine)
|
||||
{
|
||||
#if RIPPLE_ENABLE_TICKETS
|
||||
if (! engine->enableTickets())
|
||||
return temDISABLED;
|
||||
return CreateTicket (txn, params, engine).apply ();
|
||||
#else
|
||||
return temDISABLED;
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user