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;
|
bool didApply;
|
||||||
if (stx)
|
if (stx)
|
||||||
{
|
{
|
||||||
TransactionEngine txe (ledger, multisign);
|
TransactionEngine txe (ledger,
|
||||||
|
tx_enable_test);
|
||||||
std::tie(ter, didApply) = txe.applyTransaction(
|
std::tie(ter, didApply) = txe.applyTransaction(
|
||||||
*stx, tapOPEN_LEDGER |
|
*stx, tapOPEN_LEDGER |
|
||||||
(true ? tapNONE : tapNO_CHECK_SIGN));
|
(true ? tapNONE : tapNO_CHECK_SIGN));
|
||||||
|
|||||||
@@ -30,8 +30,8 @@ namespace ripple {
|
|||||||
// A TransactionEngine applies serialized transactions to a ledger
|
// A TransactionEngine applies serialized transactions to a ledger
|
||||||
// It can also, verify signatures, verify fees, and give rejection reasons
|
// It can also, verify signatures, verify fees, and give rejection reasons
|
||||||
|
|
||||||
struct multisign_t { multisign_t() { } };
|
struct tx_enable_test_t { tx_enable_test_t() { } };
|
||||||
static multisign_t const multisign;
|
static tx_enable_test_t const tx_enable_test;
|
||||||
|
|
||||||
// One instance per ledger.
|
// One instance per ledger.
|
||||||
// Only one transaction applied at a time.
|
// Only one transaction applied at a time.
|
||||||
@@ -45,8 +45,17 @@ private:
|
|||||||
false;
|
false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
bool enableTickets_ =
|
||||||
|
#if RIPPLE_ENABLE_TICKETS
|
||||||
|
true;
|
||||||
|
#else
|
||||||
|
false;
|
||||||
|
#endif
|
||||||
|
|
||||||
boost::optional<LedgerEntrySet> mNodes;
|
boost::optional<LedgerEntrySet> mNodes;
|
||||||
|
|
||||||
|
void txnWrite();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Ledger::pointer mLedger;
|
Ledger::pointer mLedger;
|
||||||
int mTxnSeq = 0;
|
int mTxnSeq = 0;
|
||||||
@@ -61,8 +70,10 @@ public:
|
|||||||
assert (mLedger);
|
assert (mLedger);
|
||||||
}
|
}
|
||||||
|
|
||||||
TransactionEngine (Ledger::ref ledger, multisign_t)
|
TransactionEngine (Ledger::ref ledger,
|
||||||
|
tx_enable_test_t)
|
||||||
: enableMultiSign_(true)
|
: enableMultiSign_(true)
|
||||||
|
, enableTickets_(true)
|
||||||
, mLedger (ledger)
|
, mLedger (ledger)
|
||||||
{
|
{
|
||||||
assert (mLedger);
|
assert (mLedger);
|
||||||
@@ -74,6 +85,12 @@ public:
|
|||||||
return enableMultiSign_;
|
return enableMultiSign_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
enableTickets() const
|
||||||
|
{
|
||||||
|
return enableTickets_;
|
||||||
|
}
|
||||||
|
|
||||||
LedgerEntrySet&
|
LedgerEntrySet&
|
||||||
view ()
|
view ()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -93,11 +93,9 @@ transact_CancelTicket (
|
|||||||
TransactionEngineParams params,
|
TransactionEngineParams params,
|
||||||
TransactionEngine* engine)
|
TransactionEngine* engine)
|
||||||
{
|
{
|
||||||
#if RIPPLE_ENABLE_TICKETS
|
if (! engine->enableTickets())
|
||||||
return CancelTicket (txn, params, engine).apply ();
|
|
||||||
#else
|
|
||||||
return temDISABLED;
|
return temDISABLED;
|
||||||
#endif
|
return CancelTicket (txn, params, engine).apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -145,11 +145,9 @@ transact_CreateTicket (
|
|||||||
TransactionEngineParams params,
|
TransactionEngineParams params,
|
||||||
TransactionEngine* engine)
|
TransactionEngine* engine)
|
||||||
{
|
{
|
||||||
#if RIPPLE_ENABLE_TICKETS
|
if (! engine->enableTickets())
|
||||||
return CreateTicket (txn, params, engine).apply ();
|
|
||||||
#else
|
|
||||||
return temDISABLED;
|
return temDISABLED;
|
||||||
#endif
|
return CreateTicket (txn, params, engine).apply ();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user