mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Replace LEDGER_JSON_ macros with an enum.
This commit is contained in:
@@ -928,7 +928,7 @@ Ledger::pointer Ledger::getSQL (std::string const& sql)
|
|||||||
{
|
{
|
||||||
WriteLog (lsERROR, Ledger) << "Failed on ledger";
|
WriteLog (lsERROR, Ledger) << "Failed on ledger";
|
||||||
Json::Value p;
|
Json::Value p;
|
||||||
addJson (p, {*ret, LEDGER_JSON_FULL});
|
addJson (p, {*ret, LedgerFill::full});
|
||||||
WriteLog (lsERROR, Ledger) << p;
|
WriteLog (lsERROR, Ledger) << p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -49,11 +49,6 @@ enum LedgerStateParms
|
|||||||
lepERROR = 32, // error
|
lepERROR = 32, // error
|
||||||
};
|
};
|
||||||
|
|
||||||
#define LEDGER_JSON_DUMP_TXRP 0x1
|
|
||||||
#define LEDGER_JSON_DUMP_STATE 0x2
|
|
||||||
#define LEDGER_JSON_EXPAND 0x4
|
|
||||||
#define LEDGER_JSON_FULL 0x8
|
|
||||||
|
|
||||||
class SqliteStatement;
|
class SqliteStatement;
|
||||||
|
|
||||||
// VFALCO TODO figure out exactly how this thing works.
|
// VFALCO TODO figure out exactly how this thing works.
|
||||||
|
|||||||
@@ -43,6 +43,8 @@ struct LedgerFill
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum Options {dumpTxrp = 1, dumpState = 2, expand = 4, full = 8};
|
||||||
|
|
||||||
Ledger const& ledger;
|
Ledger const& ledger;
|
||||||
int options;
|
int options;
|
||||||
RPC::Yield yield;
|
RPC::Yield yield;
|
||||||
@@ -71,8 +73,8 @@ void fillJson (Object& json, LedgerFill const& fill)
|
|||||||
{
|
{
|
||||||
auto const& ledger = fill.ledger;
|
auto const& ledger = fill.ledger;
|
||||||
|
|
||||||
bool const bFull (fill.options & LEDGER_JSON_FULL);
|
bool const bFull (fill.options & LedgerFill::full);
|
||||||
bool const bExpand (fill.options & LEDGER_JSON_EXPAND);
|
bool const bExpand (fill.options & LedgerFill::expand);
|
||||||
|
|
||||||
// DEPRECATED
|
// DEPRECATED
|
||||||
json[jss::seqNum] = to_string (ledger.getLedgerSeq());
|
json[jss::seqNum] = to_string (ledger.getLedgerSeq());
|
||||||
@@ -114,7 +116,7 @@ void fillJson (Object& json, LedgerFill const& fill)
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto &transactionMap = ledger.peekTransactionMap();
|
auto &transactionMap = ledger.peekTransactionMap();
|
||||||
if (transactionMap && (bFull || fill.options & LEDGER_JSON_DUMP_TXRP))
|
if (transactionMap && (bFull || fill.options & LedgerFill::dumpTxrp))
|
||||||
{
|
{
|
||||||
auto&& txns = RPC::addArray (json, jss::transactions);
|
auto&& txns = RPC::addArray (json, jss::transactions);
|
||||||
SHAMapTreeNode::TNType type;
|
SHAMapTreeNode::TNType type;
|
||||||
@@ -159,7 +161,7 @@ void fillJson (Object& json, LedgerFill const& fill)
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto& accountStateMap = ledger.peekAccountStateMap();
|
auto& accountStateMap = ledger.peekAccountStateMap();
|
||||||
if (accountStateMap && (bFull || fill.options & LEDGER_JSON_DUMP_STATE))
|
if (accountStateMap && (bFull || fill.options & LedgerFill::dumpState))
|
||||||
{
|
{
|
||||||
auto&& array = RPC::addArray (json, jss::accountState);
|
auto&& array = RPC::addArray (json, jss::accountState);
|
||||||
RPC::CountedYield count (
|
RPC::CountedYield count (
|
||||||
|
|||||||
@@ -49,10 +49,10 @@ Status LedgerHandler::check ()
|
|||||||
bool bAccounts = params[jss::accounts].asBool();
|
bool bAccounts = params[jss::accounts].asBool();
|
||||||
bool bExpand = params[jss::expand].asBool();
|
bool bExpand = params[jss::expand].asBool();
|
||||||
|
|
||||||
options_ = (bFull ? LEDGER_JSON_FULL : 0)
|
options_ = (bFull ? LedgerFill::full : 0)
|
||||||
| (bExpand ? LEDGER_JSON_EXPAND : 0)
|
| (bExpand ? LedgerFill::expand : 0)
|
||||||
| (bTransactions ? LEDGER_JSON_DUMP_TXRP : 0)
|
| (bTransactions ? LedgerFill::dumpTxrp : 0)
|
||||||
| (bAccounts ? LEDGER_JSON_DUMP_STATE : 0);
|
| (bAccounts ? LedgerFill::dumpState : 0);
|
||||||
|
|
||||||
if (bFull || bAccounts)
|
if (bFull || bAccounts)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user