diff --git a/src/ripple/app/ledger/Ledger.cpp b/src/ripple/app/ledger/Ledger.cpp index 1230d15b2..95131dc03 100644 --- a/src/ripple/app/ledger/Ledger.cpp +++ b/src/ripple/app/ledger/Ledger.cpp @@ -928,7 +928,7 @@ Ledger::pointer Ledger::getSQL (std::string const& sql) { WriteLog (lsERROR, Ledger) << "Failed on ledger"; Json::Value p; - addJson (p, {*ret, LEDGER_JSON_FULL}); + addJson (p, {*ret, LedgerFill::full}); WriteLog (lsERROR, Ledger) << p; } diff --git a/src/ripple/app/ledger/Ledger.h b/src/ripple/app/ledger/Ledger.h index ad7a60f75..655d22ea6 100644 --- a/src/ripple/app/ledger/Ledger.h +++ b/src/ripple/app/ledger/Ledger.h @@ -49,11 +49,6 @@ enum LedgerStateParms 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; // VFALCO TODO figure out exactly how this thing works. diff --git a/src/ripple/app/ledger/LedgerToJson.h b/src/ripple/app/ledger/LedgerToJson.h index a50b98109..fe09acec8 100644 --- a/src/ripple/app/ledger/LedgerToJson.h +++ b/src/ripple/app/ledger/LedgerToJson.h @@ -43,6 +43,8 @@ struct LedgerFill { } + enum Options {dumpTxrp = 1, dumpState = 2, expand = 4, full = 8}; + Ledger const& ledger; int options; RPC::Yield yield; @@ -71,8 +73,8 @@ void fillJson (Object& json, LedgerFill const& fill) { auto const& ledger = fill.ledger; - bool const bFull (fill.options & LEDGER_JSON_FULL); - bool const bExpand (fill.options & LEDGER_JSON_EXPAND); + bool const bFull (fill.options & LedgerFill::full); + bool const bExpand (fill.options & LedgerFill::expand); // DEPRECATED json[jss::seqNum] = to_string (ledger.getLedgerSeq()); @@ -114,7 +116,7 @@ void fillJson (Object& json, LedgerFill const& fill) } 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); SHAMapTreeNode::TNType type; @@ -159,7 +161,7 @@ void fillJson (Object& json, LedgerFill const& fill) } 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); RPC::CountedYield count ( diff --git a/src/ripple/rpc/handlers/Ledger.cpp b/src/ripple/rpc/handlers/Ledger.cpp index 67fa36e17..8792f6217 100644 --- a/src/ripple/rpc/handlers/Ledger.cpp +++ b/src/ripple/rpc/handlers/Ledger.cpp @@ -49,10 +49,10 @@ Status LedgerHandler::check () bool bAccounts = params[jss::accounts].asBool(); bool bExpand = params[jss::expand].asBool(); - options_ = (bFull ? LEDGER_JSON_FULL : 0) - | (bExpand ? LEDGER_JSON_EXPAND : 0) - | (bTransactions ? LEDGER_JSON_DUMP_TXRP : 0) - | (bAccounts ? LEDGER_JSON_DUMP_STATE : 0); + options_ = (bFull ? LedgerFill::full : 0) + | (bExpand ? LedgerFill::expand : 0) + | (bTransactions ? LedgerFill::dumpTxrp : 0) + | (bAccounts ? LedgerFill::dumpState : 0); if (bFull || bAccounts) {