From e3ada6c5da6e0bb6be055539f29c26cd5b749f5d Mon Sep 17 00:00:00 2001 From: cyan317 <120398799+cindyyan317@users.noreply.github.com> Date: Mon, 7 Aug 2023 18:23:13 +0100 Subject: [PATCH] Remove deprecated fields (#814) Fix #801 --- src/rpc/handlers/Ledger.cpp | 2 -- src/rpc/handlers/LedgerData.cpp | 2 -- unittests/rpc/handlers/LedgerDataTest.cpp | 6 ------ unittests/rpc/handlers/LedgerTest.cpp | 8 -------- 4 files changed, 18 deletions(-) diff --git a/src/rpc/handlers/Ledger.cpp b/src/rpc/handlers/Ledger.cpp index c1269d2f..abc8d570 100644 --- a/src/rpc/handlers/Ledger.cpp +++ b/src/rpc/handlers/Ledger.cpp @@ -39,14 +39,12 @@ LedgerHandler::process(LedgerHandler::Input input, Context const& ctx) const } else { - output.header[JS(accepted)] = true; output.header[JS(account_hash)] = ripple::strHex(lgrInfo.accountHash); output.header[JS(close_flags)] = lgrInfo.closeFlags; output.header[JS(close_time)] = lgrInfo.closeTime.time_since_epoch().count(); output.header[JS(close_time_human)] = ripple::to_string(lgrInfo.closeTime); output.header[JS(close_time_resolution)] = lgrInfo.closeTimeResolution.count(); output.header[JS(closed)] = true; - output.header[JS(hash)] = ripple::strHex(lgrInfo.hash); output.header[JS(ledger_hash)] = ripple::strHex(lgrInfo.hash); output.header[JS(ledger_index)] = std::to_string(lgrInfo.seq); output.header[JS(parent_close_time)] = lgrInfo.parentCloseTime.time_since_epoch().count(); diff --git a/src/rpc/handlers/LedgerData.cpp b/src/rpc/handlers/LedgerData.cpp index 3da10ae9..d4040768 100644 --- a/src/rpc/handlers/LedgerData.cpp +++ b/src/rpc/handlers/LedgerData.cpp @@ -82,13 +82,11 @@ LedgerDataHandler::process(Input input, Context const& ctx) const } else { - header[JS(accepted)] = true; header[JS(account_hash)] = ripple::strHex(lgrInfo.accountHash); header[JS(close_flags)] = lgrInfo.closeFlags; header[JS(close_time)] = lgrInfo.closeTime.time_since_epoch().count(); header[JS(close_time_human)] = ripple::to_string(lgrInfo.closeTime); header[JS(close_time_resolution)] = lgrInfo.closeTimeResolution.count(); - header[JS(hash)] = ripple::strHex(lgrInfo.hash); header[JS(ledger_hash)] = ripple::strHex(lgrInfo.hash); header[JS(ledger_index)] = std::to_string(lgrInfo.seq); header[JS(parent_close_time)] = lgrInfo.parentCloseTime.time_since_epoch().count(); diff --git a/unittests/rpc/handlers/LedgerDataTest.cpp b/unittests/rpc/handlers/LedgerDataTest.cpp index ff8a937e..40223e6d 100644 --- a/unittests/rpc/handlers/LedgerDataTest.cpp +++ b/unittests/rpc/handlers/LedgerDataTest.cpp @@ -221,12 +221,10 @@ TEST_F(RPCLedgerDataHandlerTest, MarkerNotExist) TEST_F(RPCLedgerDataHandlerTest, NoMarker) { static auto const ledgerExpected = R"({ - "accepted":true, "account_hash":"0000000000000000000000000000000000000000000000000000000000000000", "close_flags":0, "close_time":0, "close_time_resolution":0, - "hash":"4BC50C9B0D8515D3EAAE1E74B29A95804346C491EE1A95BF25E4AAB854A6A652", "ledger_hash":"4BC50C9B0D8515D3EAAE1E74B29A95804346C491EE1A95BF25E4AAB854A6A652", "ledger_index":"30", "parent_close_time":0, @@ -287,12 +285,10 @@ TEST_F(RPCLedgerDataHandlerTest, NoMarker) TEST_F(RPCLedgerDataHandlerTest, TypeFilter) { static auto const ledgerExpected = R"({ - "accepted":true, "account_hash":"0000000000000000000000000000000000000000000000000000000000000000", "close_flags":0, "close_time":0, "close_time_resolution":0, - "hash":"4BC50C9B0D8515D3EAAE1E74B29A95804346C491EE1A95BF25E4AAB854A6A652", "ledger_hash":"4BC50C9B0D8515D3EAAE1E74B29A95804346C491EE1A95BF25E4AAB854A6A652", "ledger_index":"30", "parent_close_time":0, @@ -356,12 +352,10 @@ TEST_F(RPCLedgerDataHandlerTest, TypeFilter) TEST_F(RPCLedgerDataHandlerTest, OutOfOrder) { static auto const ledgerExpected = R"({ - "accepted":true, "account_hash":"0000000000000000000000000000000000000000000000000000000000000000", "close_flags":0, "close_time":0, "close_time_resolution":0, - "hash":"4BC50C9B0D8515D3EAAE1E74B29A95804346C491EE1A95BF25E4AAB854A6A652", "ledger_hash":"4BC50C9B0D8515D3EAAE1E74B29A95804346C491EE1A95BF25E4AAB854A6A652", "ledger_index":"30", "parent_close_time":0, diff --git a/unittests/rpc/handlers/LedgerTest.cpp b/unittests/rpc/handlers/LedgerTest.cpp index fdc6a952..3f1a356b 100644 --- a/unittests/rpc/handlers/LedgerTest.cpp +++ b/unittests/rpc/handlers/LedgerTest.cpp @@ -256,13 +256,11 @@ TEST_F(RPCLedgerHandlerTest, Default) "ledger_index":30, "validated":true, "ledger":{ - "accepted":true, "account_hash":"0000000000000000000000000000000000000000000000000000000000000000", "close_flags":0, "close_time":0, "close_time_resolution":0, "closed":true, - "hash":"4BC50C9B0D8515D3EAAE1E74B29A95804346C491EE1A95BF25E4AAB854A6A652", "ledger_hash":"4BC50C9B0D8515D3EAAE1E74B29A95804346C491EE1A95BF25E4AAB854A6A652", "ledger_index":"30", "parent_close_time":0, @@ -444,13 +442,11 @@ TEST_F(RPCLedgerHandlerTest, TransactionsExpandNotBinary) "ledger_index":30, "validated":true, "ledger":{ - "accepted":true, "account_hash":"0000000000000000000000000000000000000000000000000000000000000000", "close_flags":0, "close_time":0, "close_time_resolution":0, "closed":true, - "hash":"4BC50C9B0D8515D3EAAE1E74B29A95804346C491EE1A95BF25E4AAB854A6A652", "ledger_hash":"4BC50C9B0D8515D3EAAE1E74B29A95804346C491EE1A95BF25E4AAB854A6A652", "ledger_index":"30", "parent_close_time":0, @@ -664,13 +660,11 @@ TEST_F(RPCLedgerHandlerTest, OwnerFundsEmtpy) "ledger_index":30, "validated":true, "ledger":{ - "accepted":true, "account_hash":"0000000000000000000000000000000000000000000000000000000000000000", "close_flags":0, "close_time":0, "close_time_resolution":0, "closed":true, - "hash":"4BC50C9B0D8515D3EAAE1E74B29A95804346C491EE1A95BF25E4AAB854A6A652", "ledger_hash":"4BC50C9B0D8515D3EAAE1E74B29A95804346C491EE1A95BF25E4AAB854A6A652", "ledger_index":"30", "parent_close_time":0, @@ -754,13 +748,11 @@ TEST_F(RPCLedgerHandlerTest, OwnerFundsTrueBinaryFalse) static auto constexpr expectedOut = R"({ "ledger": { - "accepted": true, "account_hash": "0000000000000000000000000000000000000000000000000000000000000000", "close_flags": 0, "close_time": 0, "close_time_resolution": 0, "closed": true, - "hash": "4BC50C9B0D8515D3EAAE1E74B29A95804346C491EE1A95BF25E4AAB854A6A652", "ledger_hash": "4BC50C9B0D8515D3EAAE1E74B29A95804346C491EE1A95BF25E4AAB854A6A652", "ledger_index": "30", "parent_close_time": 0,