mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-01 16:05:52 +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:
@@ -135,27 +135,38 @@ doLedgerGrpc(RPC::GRPCContext<org::xrpl::rpc::v1::GetLedgerRequest>& context)
|
|||||||
|
|
||||||
if (request.transactions())
|
if (request.transactions())
|
||||||
{
|
{
|
||||||
for (auto& i : ledger->txs)
|
try
|
||||||
{
|
{
|
||||||
assert(i.first);
|
for (auto& i : ledger->txs)
|
||||||
if (request.expand())
|
|
||||||
{
|
{
|
||||||
auto txn =
|
assert(i.first);
|
||||||
response.mutable_transactions_list()->add_transactions();
|
if (request.expand())
|
||||||
Serializer sTxn = i.first->getSerializer();
|
|
||||||
txn->set_transaction_blob(sTxn.data(), sTxn.getLength());
|
|
||||||
if (i.second)
|
|
||||||
{
|
{
|
||||||
Serializer sMeta = i.second->getSerializer();
|
auto txn = response.mutable_transactions_list()
|
||||||
txn->set_metadata_blob(sMeta.data(), sMeta.getLength());
|
->add_transactions();
|
||||||
|
Serializer sTxn = i.first->getSerializer();
|
||||||
|
txn->set_transaction_blob(sTxn.data(), sTxn.getLength());
|
||||||
|
if (i.second)
|
||||||
|
{
|
||||||
|
Serializer sMeta = i.second->getSerializer();
|
||||||
|
txn->set_metadata_blob(sMeta.data(), sMeta.getLength());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
auto const& hash = i.first->getTransactionID();
|
||||||
|
response.mutable_hashes_list()->add_hashes(
|
||||||
|
hash.data(), hash.size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
{
|
catch (std::exception const& e)
|
||||||
auto const& hash = i.first->getTransactionID();
|
{
|
||||||
response.mutable_hashes_list()->add_hashes(
|
JLOG(context.j.error())
|
||||||
hash.data(), hash.size());
|
<< __func__ << " - Error deserializing transaction in ledger "
|
||||||
}
|
<< ledger->info().seq
|
||||||
|
<< " . skipping transaction and following transactions. You "
|
||||||
|
"should look into this further";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user