mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-02 16:35:49 +00:00
Catch transaction deserialization error in doLedgerGrpc (#4323)
* Allow clio to extract ledgers with transactions that can no longer be deserialized. The problem transactions will be skipped.
This commit is contained in:
@@ -134,14 +134,16 @@ doLedgerGrpc(RPC::GRPCContext<org::xrpl::rpc::v1::GetLedgerRequest>& context)
|
|||||||
response.set_ledger_header(s.peekData().data(), s.getLength());
|
response.set_ledger_header(s.peekData().data(), s.getLength());
|
||||||
|
|
||||||
if (request.transactions())
|
if (request.transactions())
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
for (auto& i : ledger->txs)
|
for (auto& i : ledger->txs)
|
||||||
{
|
{
|
||||||
assert(i.first);
|
assert(i.first);
|
||||||
if (request.expand())
|
if (request.expand())
|
||||||
{
|
{
|
||||||
auto txn =
|
auto txn = response.mutable_transactions_list()
|
||||||
response.mutable_transactions_list()->add_transactions();
|
->add_transactions();
|
||||||
Serializer sTxn = i.first->getSerializer();
|
Serializer sTxn = i.first->getSerializer();
|
||||||
txn->set_transaction_blob(sTxn.data(), sTxn.getLength());
|
txn->set_transaction_blob(sTxn.data(), sTxn.getLength());
|
||||||
if (i.second)
|
if (i.second)
|
||||||
@@ -158,6 +160,15 @@ doLedgerGrpc(RPC::GRPCContext<org::xrpl::rpc::v1::GetLedgerRequest>& context)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (std::exception const& e)
|
||||||
|
{
|
||||||
|
JLOG(context.j.error())
|
||||||
|
<< __func__ << " - Error deserializing transaction in ledger "
|
||||||
|
<< ledger->info().seq
|
||||||
|
<< " . skipping transaction and following transactions. You "
|
||||||
|
"should look into this further";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (request.get_objects())
|
if (request.get_objects())
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user